문제: 무단 배포 금지로 인해 사이트 주소로 남깁니다.
https://swexpertacademy.com/main/code/problem/problemDetail.do?contestProbId=AV5Pl0Q6ANQDFAUq
정답 코드:
T = int(input())
for test_case in range(1, T + 1):
N = int(input())
two = 0
three = 0
five = 0
seven = 0
eleven = 0
while N % 2 == 0:
N //= 2
two += 1
while N % 3 == 0:
N //= 3
three += 1
while N % 5 == 0:
N //= 5
five += 1
while N % 7 == 0:
N //= 7
seven += 1
while N % 11 == 0:
N //= 11
eleven += 1
print(f"#{test_case} {two} {three} {five} {seven} {eleven}")
'SWEA' 카테고리의 다른 글
2007. 패턴 마디의 길이 (0) | 2024.07.15 |
---|---|
1284. 수도 요금 경쟁 (0) | 2024.07.15 |
1954 .달팽이 숫자 (0) | 2024.07.15 |
1959. 두 개의 숫자열 (0) | 2024.07.15 |
1961. 숫자 배열 회전 (0) | 2024.07.15 |