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