본문 바로가기

파이썬2192

[백준/파이썬] 32154번 SUAPC 2024 Winter -Codetotal = { 1: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'L', 'M'], 2: ['A', 'C', 'E', 'F', 'G', 'H', 'I', 'L', 'M'], 3: ['A', 'C', 'E', 'F', 'G', 'H', 'I', 'L', 'M'], 4: ['A', 'B', 'C', 'E', 'F', 'G', 'H', 'L', 'M'], 5: ['A', 'C', 'E', 'F', 'G', 'H', 'L', 'M'], 6: ['A', 'C', 'E', 'F', 'G', 'H', 'L', 'M'], 7: ['A', 'C', 'E', 'F', 'G', 'H', 'L', 'M'], 8: ['A', 'C', .. 2024. 9. 2.
[백준/파이썬] 32193번 승강장의 깊이 -Codefrom sys import stdintotal = 0for _ in range(int(stdin.readline())): a, b = map(int, stdin.readline().split()) total = a - b + total print(total) 2024. 9. 1.
[백준/파이썬] 18156번 Black and White -Coden = int(input())arr = [input() for _ in range(n)]res = 1for x in range(n): line = arr[x] if line.count('B') > n // 2 or line.count('W') > n // 2: res = 0 if 'BBB' in line or 'WWW' in line: res = 0if res == 1: for x in range(n): line = "" for y in range(n): line += arr[y][x] if line.count('B') > n // 2 or line.count('W') > n // 2: .. 2024. 8. 31.
[백준/파이썬] 24803번 Provinces and Gold -Codeg, s, c = map(int, input().split())total = g * 3 + s * 2 + ccard, treasure = "", ""if total >= 8: card = "Province"elif total >= 5: card = "Duchy"elif total >= 2: card = "Estate"if total >= 6: treasure = "Gold"elif total >= 3: treasure = "Silver"elif total >= 0: treasure = "Copper"print(f"{card} or {treasure}" if card != "" else treasure) 2024. 8. 30.
[백준/파이썬] 5340번 Secret Location -Coderes = []for _ in range(6): line = input().rstrip() res.append(len(line))print(f"Latitude {res[0]}:{res[1]}:{res[2]}")print(f"Longitude {res[3]}:{res[4]}:{res[5]}") 2024. 8. 29.
[백준/파이썬] 9771번 Word Searching -Codew = input()res = 0while True: try: s = input() res += s.count(w) except: breakprint(res) 2024. 8. 28.