본문 바로가기

파이썬2187

[백준/파이썬] 2841번 외계인의 기타 연주 -Codefrom sys import stdininput = stdin.readlinestrings = {1: [], 2: [], 3: [], 4: [], 5: [], 6: []}n, m = map(int, input().split())res = 0for _ in range(n): s, f = map(int, input().split()) while True: if len(strings[s]) > 0 and strings[s][-1] == f: break res += 1 if not len(strings[s]) or strings[s][-1] 2025. 1. 20.
[백준/파이썬] 33165번 徒競走 (Footrace) -Codeprint(int(input()) * int(input())) 2025. 1. 19.
[백준/파이썬] 10844번 쉬운 계단 수 -Codemod = int(1e9)dp = [[0] * 10 for _ in range(101)]for i in range(1, 10): dp[1][i] = 1res = 0n = int(input())for i in range(2, n + 1): for j in range(10): if j > 0: dp[i][j] += dp[i - 1][j - 1] % mod if j 2025. 1. 19.
[백준/파이썬] 33161번 鉛筆 2 (Pencils 2) -Codeprint(int(input()) // 5) 2025. 1. 18.
[백준/파이썬] 24417번 알고리즘 수업 - 피보나치 수 2 -Coden = int(input())mod = 1000000007a, b = 1, 1for i in range(2, n): a, b = b, (a + b) % modprint(b, n - 2)python3로 시간 초과가 나서 pypy3로 제출했습니다. 2025. 1. 17.
[백준/파이썬] 9298번 Ant Entrapment -Codefor t in range(int(input())): n = int(input()) x_list, y_list = [], [] for _ in range(n): x, y = map(float, input().split()) x_list.append(x) y_list.append(y) x_max, x_min = max(x_list), min(x_list) y_max, y_min = max(y_list), min(y_list) x_len = x_max - x_min y_len = y_max - y_min print(f"Case {t + 1}: Area {x_len * y_len}, Perimeter {(x_len + y.. 2025. 1. 16.