题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
#include <iostream> #include <cmath> using namespace std; int main(){ long n,a; cin >> n; a = n; for(int i = 2; i <= sqrt(n); i++) { while (n % i == 0) { cout << i << " "; n /= i; continue; } } if(n -1 > 0) cout << n << endl; return 0; }