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