[SW Expert Academy, SWEA 1288] 새로운 불면증 치료법 (python)
Problem Solving/SWEA

[SW Expert Academy, SWEA 1288] 새로운 불면증 치료법 (python)

728x90

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=2&contestProbId=AV18_yw6I9MCFAZN&categoryId=AV18_yw6I9MCFAZN&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=2&pageSize=10&pageIndex=3

 

SW Expert Academy

SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요!

swexpertacademy.com


※ SW Expert 아카데미의 문제를 무단 복제하는 것을 금지합니다.

728x90

내 생각

출력을 굉장히 헷갈리게 만들어 놨다.

최소 몇 번 양을 세었는지의 '몇 번'이 횟수가 아니라 양의 번호다.

즉, N이 2일 때,

45 x N이면 0에서 9까지의 모든 수를 보게 된다.

여기서 답은 45가 아니라, (45x2)번째 양까지 셌으니 90을 출력해야 한다.

민석이 잠 다 잤네

T = int(input())

for test_case in range(1, T + 1):
    N = int(input())
    num = [0] * 10
    k = 1

    while(0 in num):
        str_N = str(N * k)
        for s in str_N:
            num[int(s)] += 1
        k += 1

    print("#{} {}".format(test_case, (k - 1) * N))
728x90