본문 바로가기

백준2489

[백준/파이썬] 6243번 Mileage Bank -Codefrom math import ceilmileage = 0while True: line = list(input().split()) if line[0] == "#": break if line[0] == "0": print(mileage) mileage = 0 continue distance = int(line[2]) if line[3] == "F": distance *= 2 elif line[3] == "B": distance += ceil(distance * 0.5) else: distance = max(distance, 500) mileage += distance 2025. 3. 13.
[백준/파이썬] 9924번 The Euclidean Algorithm -Codea, b = map(int, input().split())cnt = 0while a != b: if a > b: a -= b else: b -= a cnt += 1print(cnt) 2025. 3. 12.
[백준/파이썬] 26350번 Basket -Codex = int(input())s = int(input())p = int(input())res = x if s == 1 else 0if p == 1: t = 1 if s == 1 else x for _ in range(t): res += int(input())print(res) 2025. 3. 11.
[백준/파이썬] 29657번 Стандарты времени -Codea1, b1, c1 = map(int, input().split())a2, b2, c2 = map(int, input().split())h, m, s = map(int, input().split())total_seconds = h * b1 * c1 + m * c1 + sres_h = total_seconds // (b2 * c2) % a2res_m = total_seconds % (b2 * c2) // c2res_s = total_seconds % c2print(res_h, res_m, res_s) 2025. 3. 10.
[백준/파이썬] 21875번 Innohorse -Codecell1 = input()cell2 = input()x = abs(ord(cell1[0]) - ord(cell2[0]))y = abs(int(cell1[1]) - int(cell2[1]))print(*sorted([x, y])) 2025. 3. 8.
[백준/파이썬] 21280번 Förvirrad föreläsare -Coden = int(input())arr = list(map(int, input().split()))now = arr[0]res = [0, 0]for el in arr[1:]: if now > el: res[0] += now - el elif now 2025. 3. 7.