题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
import sys import math for line in sys.stdin: a = line.split() n = int(a[0]) factors = [] i = 2 while n % 2 == 0: factors.append(2) n = n / 2 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: factors.append(i) n = n / i if n > 2: factors.append(int(n)) for i in factors: print(i, end=" ") break