import solution1 print(solution1.solution("KAKAO")) # [11, 1, 27, 15] print(solution1.solution("TOBEORNOTTOBEORTOBEORNOT") ) # [20, 15, 2, 5, 15, 18, 14, 15, 20, 27, 29, 31, 36, 30, 32, 34] print(solution1.solution("ABABABABABABABAB")) # [1, 2, 27, 29, 28, 31, 30]
from solution1 import solution arr1 = [4, 3, 2, 1] print(solution(arr1)) arr2 = [10] print(solution(arr2))
for k in range(0, floor(p_num * CONSTRANINTS["number_of_item"])): Problem["v"].append(random.randint(0, CONSTRANINTS["value"])) for k in range(0, floor(p_num * CONSTRANINTS["number_of_item"])): Problem["w"].append( random.randint(last_weight, floor(p_weight * CONSTRANINTS["weight"]))) # Write problem to file inp.txt inp = open("inp.txt", 'a') inp.write(str(Problem["W"]) + "\n") for item in Problem["v"]: inp.write("%s " % item) inp.write("\n") for item in Problem["w"]: inp.write("%s " % item) inp.write("\n") inp.close() # Write solution to file out.txt out = open("out.txt", 'a') out.write(str(solution(Problem)) + "\n") out.close() print(f"TEST {i} CREATED!") last_value = floor(p * CONSTRANINTS["value"]) last_weight = floor(p_weight * CONSTRANINTS["weight"]) last_num_of_item = floor(p_num * CONSTRANINTS["number_of_item"]) last_total_weight = floor(p_tot_weight * CONSTRANINTS["total_weight"]) current_test = end
#1번 from solution1 import solution s = "a1234" print(solution(s)) s = "1234" print(solution(s))
def test_solution(): assert solution('2018/input/input1.txt') == (402, 481)
from solution1 import solution print(solution('pyPPYYY')) # False print(solution('PyPpYY')) # True
from solution1 import solution n = 0 print(solution(n)) n = 1 print(solution(n)) n = 3000 print(solution(n)) n = 150 print(solution(n))