题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
#include <iostream> using namespace std; int main() { long a; while(cin >> a) { for(long i=2; i*i<=a; i++){ while(a%i == 0) { cout << i << " "; a = a/i; } } if (a != 1) { cout << a <<endl; } } } // 64 位输出请用 printf("%lld")