题解 | #质数因子#
质数因子
https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
#include <iostream> #include <cmath> using namespace std; int main() { int a; while (cin >> a ) { // 注意 while 处理多个 case for(int b = 2; b <= sqrt(a); ++b) { while( a % b == 0){ cout << b << " "; a /=b; } } if(a != 1) cout << a; } }