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