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