백준 13717번: 포켓몬 GO #Python

ColorlessDia·2024년 8월 20일

algorithm/baekjoon

목록 보기
275/808
import sys

N = int(sys.stdin.readline())

pokemon_list = [0] * N

max_count = 0
total_count = 0

for i in range(N):
    P = sys.stdin.readline().rstrip()
    K, M = map(int, sys.stdin.readline().split())

    each_count = 0

    while K <= M:
        M -= K - 2
        each_count += 1
    
    if max_count < each_count:
        max_count = each_count

    pokemon_list[i] = (P, each_count)

    total_count += each_count

target_pokemon = ''

for pokemon, count in pokemon_list:
    
    if count == max_count:
        target_pokemon = pokemon
        break

print(total_count)
print(pokemon)

0개의 댓글