본문 바로가기
코딩테스트/SWExpertAcademy

[Python] SWEA 13622 - 간단한 소인수분해

by Ssubini 2022. 4. 13.

[2022.02.10]

T = int(input())
for tc in range(T):
    N = int(input())
    pnum = [2,3,5,7,11]
    answer = []

    for p in pnum:
        cnt = 0
        while True:
            if N % p != 0 : break
            else :
                N //= p
                cnt += 1
        answer.append(cnt)

    print(f'#{tc+1}',end=' ')
    print(*answer)

댓글