Programming/Python & Data Structures
[Baekjoon/Python3] 2312번 수 복원하기
HooNeee
2020. 12. 3. 01:14
[Baekjoon/Python3] 2312번 수 복원하기
2312번: 수 복원하기
첫째 줄에 테스트 케이스의 수가 주어진다. 각 테스트 케이스마다 양의 정수 N (2 ≤ N ≤ 100,000)이 주어진다.
www.acmicpc.net
t = int(input())
for i in range(t):
res = dict()
n = int(input())
while n != 1:
for j in range(2, n + 1):
if n % j == 0:
if j in res:
res[j] += 1
else:
res[j] = 1
n //= j
break
for key in res.keys():
print(key, res.get(key))