백준 6627번: The Easiest Problem is This One #Python

ColorlessDia·2026년 2월 15일

algorithm/baekjoon

목록 보기
820/836
import sys

def calc_digit_sum(n):
    return sum([int(char) for char in str(n)])

input = sys.stdin.readline

while True:
    N = int(input())

    if N == 0:
        break

    P = 11
    S = calc_digit_sum(N)

    while True:
        Q = calc_digit_sum(P * N)

        if S == Q:
            print(P)
            break

        P += 1

0개의 댓글