KOREATECH 1018: 문자열 거리 최소화 하기 Link : judge.koreatech.ac.kr/problem.php?id=1018 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 from sys import stdin quest_cnt = int(stdin.readline().strip()) for i in range(quest_cnt): quest_str = stdin.readline().strip().split(' ') arr1 = quest_str[0] arr2 = quest_str[1] idx = [0 for _ in range(len(arr2) - len(arr1) + 1)] for x in range(len(arr1)): for y in range(x, x + len(idx)):.. 2020. 12. 10. KOREATECH 1017: 돈을 줍자 Link : judge.koreatech.ac.kr/problem.php?id=1017 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 from sys import stdin testcase = int(stdin.readline().strip()) while testcase: length = int(stdin.readline().strip()) if length >= 3: dp = [0] * length arr = list(map(int, stdin.readline().strip().split(' '))) dp[0] = arr[0] dp[1] = sum(arr[0:2]) dp[2] = max((arr[0] + arr[1]), (arr[0.. 2020. 12. 9. KOREATECH 1015: 괄호 짝 Link : judge.koreatech.ac.kr/problem.php?id=1015 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 from sys import stdin quest_count = int(stdin.readline().strip()) for i in range(quest_count): quest_data = stdin.readline().strip() stack = [] for s in quest_data: if s in ('(','{','['): stack.append(s) elif s in (')','}',']'): if len(stack) == 0: print('no') break else:.. 2020. 12. 9. KOREATECH 1011: 징검다리 Link : judge.koreatech.ac.kr/problem.php?id=1011 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 from sys import stdin testcase = int(stdin.readline().strip()) while testcase: length = int(stdin.readline().strip()) dp = [0] * length if length > 2: arr = list(map(int, stdin.readline().strip().split(' '))) for _ in range(3): dp[_] = arr[_] for idx in range(3, len(arr)): dp[i.. 2020. 12. 9. KOREATECH 1010: 접두 소수 Link : judge.koreatech.ac.kr/problem.php?id=1010 Python 더보기 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 import math from sys import stdin start = ['2', '3', '5', '7'] case = ['1', '3', '7', '9'] def prime_number(number): n = int(number) for i in range(2, int(math.sqrt(n)) + 1): if n % i == 0: return False return True def makeNumber(arr=None, lengt.. 2020. 12. 9. 이전 1 ··· 13 14 15 16 17 다음