분류 전체보기(137)
-
백준 [ALGORITHM] - 공 넣기 (10810)
#include int main() { int n,m,v=0; int j,k; scanf("%d %d", &n, &m); int lst[n]; for (int i = 0; i
2024.04.28 -
백준 [ALGORITHM] - 문자열 (1120)
a, b = map(list, input().split()) cnt = 0 lst = [] for i in range(len(b)-len(a)+1): cnt = 0 for j in range(len(a)): if a[j] != b[i + j]: cnt += 1 lst.append(cnt) answer = min(lst) #print(lst) print(answer)
2024.04.08 -
백준 [ALGORITHM] - 문자열 집합 (14425)
n, m = map(int, input().split()) lst = [] temp = [] ans = dict() for i in range(n): item = input() ans[item] = 0 for j in range(m): lst.append(input()) for i in range(len(lst)): if lst[i] in ans.keys(): ans[lst[i]] += 1 print(sum(ans.values()))
2024.04.03 -
백준 [ALGORITHM] - 듣보잡 (1764)
n, m = map(int, input().split()) lst = [] temp = [] ans = dict() for i in range(n+m): lst.append(input()) for i in range(len(lst)): if lst[i] in ans: ans[lst[i]] += 1 else: ans[lst[i]] = 1 temp = sorted([key for key, value in ans.items() if value != 1]) print(len(temp)) print(*temp,sep='\n')
2024.04.03 -
백준 [ALGORITHM] - 파스칼의 삼각형 (16395)
def pascal(n): triangle = [] for i in range(n): row = [1] * (i + 1) for j in range(1, i): row[j] = triangle[i - 1][j - 1] + triangle[i - 1][j] triangle.append(row) return triangle x, y = map(int, input().split()) result = pascal(x) print(result[x-1][y-1])
2024.03.25 -
백준 [ALGORITHM] - 이름 궁합 (15312)
import string def dp(null_lst): while len(null_lst) > 2: for i in range(len(null_lst) - 1): null_lst[i] = int(null_lst[i]) + int(null_lst[i+1]) null_lst[i] = str(null_lst[i])[-1] null_lst.pop() return null_lst lst = list(string.ascii_uppercase) num = [3, 2, 1, 2, 3, 3, 2, 3, 3, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 1, 1, 1, 2, 2, 1] lst = dict(zip(lst,num)) first_input = list(input().upper()) second_..
2024.03.25