본문 바로가기

파이썬2328

[백준/파이썬] 22421번 Koto Municipal Subway -Codefrom math import sqrtwhile True: res = 100000 d, e = map(int, input().split()) if d == e == 0: break for i in range(d): now_price = abs(sqrt(i ** 2 + (d - i) ** 2) - e) res = min(res, now_price) print(f"{res:.4f}") 2024. 10. 26.
[백준/파이썬] 9971번 The Hardest Problem Ever -Codealpa = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"res = []while True: line1 = input() if line1 == "ENDOFINPUT": break decode = "" s = input().strip() for w in s: if w not in alpa: decode += w continue decode += alpa[(alpa.find(w) - 5) % 26] input() print(decode) 2024. 10. 25.
[백준/파이썬] 22341번 사각형 면적 -Coden, c = map(int, input().split())h, w = n, nfor _ in range(c): x, y = map(int, input().split()) if x >= w or y >= h: continue if h * x >= w * y: w = x else: h = yprint(h * w) 2024. 10. 24.
[백준/파이썬] 27566번 Blueberry Waffle -Coder, f = map(int, input().split())res = round(f / r) % 2print("up" if res == 0 else "down") 2024. 10. 23.
[백준/파이썬] 26564번 Poker Hand -Codefor _ in range(int(input())): cards = list(input().split()) total_cards = { 'A': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0, '10': 0, 'J': 0, 'Q': 0, 'K': 0 } for c in cards: total_cards[c[0]] += 1 max_value = max(total_cards, key=total_cards.get) print(total_cards[max_value]) 2024. 10. 22.
[백준/파이썬] 27627번 Splitology -Codeline = input()for i in range(1, len(line)): s1, s2 = line[:i], line[i:] if s1 == s1[::-1] and s2 == s2[::-1]: print(s1, s2) exit()print("NO") 2024. 10. 21.