/images/jg_02.jpg

BEAKJOON 2798, 7568, 1018, 1436

​ 2798_블랙잭 1 2 3 4 5 6 7 8 9 10 11 12 13 import sys N, M = map(int, sys.stdin.readline().split()) cards = list(map(int, sys.stdin.readline().split())) result = 0 for i in range(N): for j in range(i+1, N): for x in range(j+1, N): if cards[i] + cards[j] + cards[x] <= M: result = max(result, cards[i] + cards[j] + cards[x]) print(result) ​ 7568_덩치 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 35 36 37 38 39 40 41 42 43 import sys from collections import deque N = int(sys.

BEAKJOON 10872, 10870, 2447, 11729

​ 10872_팩토리얼 1 2 3 4 5 6 7 8 9 10 11 import sys N = int(sys.stdin.readline().rstrip()) def fac(n): if n > 1: return n * fac(n-1) else: return 1 print(fac(N)) ​ 10870_피보나치 수 5 1 2 3 4 5 6 7 8 9 10 11 import sys def fivo(n): if n >= 2: return fivo(n-1) + fivo(n-2) else: return n N = int(sys.stdin.readline().rstrip()) print(fivo(N)) ​

BEAKJOON 4948, 9020, 3053, 1002

​ 4948_베르트랑 공준 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import sys while True: N = int(sys.stdin.readline().rstrip()) if N == 0: break arr = [0,0] + [1] * ((2*N)-1) rootN = int((2*N)**0.5) for i in range(2, rootN+1): if arr[i] == 1: for j in range(2*i, 2*N+1, i): arr[j] = 0 print(sum(arr[N+1:(2*N)+1])) # 입출력에 제한이 있다가 0을 입력 받을 때 까지 # 출력을 해야 하는 조건을 달지 않는 것을 주의!

BEAKJOON 10250, 2775, 2869, 1011

​ 10250_ACM호텔 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import sys for T in range(int(sys.stdin.readline().rstrip())): H, W, N = map(int, sys.stdin.readline().split()) quo = str((N // H) + 1) rem = str(N % H) if N % H == 0: quo = str(N//H) rem = str(H) print(rem+quo.zfill(2)) # zfill? # a = "2" # b = "12" # A = a.