전체 글(137)
-
백준 [ALGORITHM] - 세로 읽기 (10798)
lst = []size = 0for i in range(5): temp_input = input() lst.append(temp_input) size_temp = len(temp_input) if size_temp >= size: size = size_temp else: passtry: for i in range(size): for j in range(5): if i
2024.07.02 -
백준 [ALGORITHM] - 수 찾기 (1920)
def bin_search(array, target, start, end): while start target: end = mid - 1 else: start = mid + 1 return Falsen = int(input())arr = list(map(int, input().split()))m = int(input())targets = list(map(int, input().split()))sorted_arr = sorted(arr)for target in targets: if bin_search(sorted_arr, target, 0, len(sorted_arr) - 1): print(1) else: ..
2024.06.13 -
백준 [ALGORITHM] - 너의 평점은 (25206)
lst = []data = { 'A+': 4.5, 'A0': 4.0, 'B+': 3.5, 'B0': 3.0, 'C+': 2.5, 'C0': 2.0, 'D+': 1.5, 'D0': 1.0, 'F' : 0.0}tot_score = 0for n in range(0,20): n = input() parts = n.split() if parts[-1] == 'P': continue else: temp = float(parts[1]) tot_score += temp score = temp * data[parts[-1]] lst.append(score)average = sum(lst) ..
2024.06.04 -
백준 [ALGORITHM] - 그룹 단어 체커 (1316)
def check_func(word): flag = True checked = set() save_chars = '' for char in word: if char in checked and char != save_chars: flag = False checked.add(char) save_chars = char return flagn = int(input())cnt = 0for i in range(n): flag = check_func(input()) if flag == True: cnt += 1print(cnt)
2024.06.02 -
백준 [ALGORITHM] - 최댓값 (2566)
lst = []addr_x, addr_y = 0, 0 for i in range(9): row = input().split() row = [int(num) for num in row] lst.append(row)maximum = lst[0][0]for i in range(len(lst)): for j in range(len(lst[i])): if maximum
2024.05.23 -
백준 [ALGORITHM] - 안녕 (1535)
def dp(health, enjoy): health = list(map(int, health)) enjoy = list(map(int, enjoy)) dp = [0] * 101 for h, e in zip(health, enjoy): if h >= 100: continue for i in range(99, h - 1, -1): dp[i] = max(dp[i], dp[i - h] + e) print(max(dp))n = int(input())health = input().split()enjoy = input().split()dp(health, enjoy)
2024.05.19