题解 | #质数因子#
质数因子
http://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607
#include<iostream>
using namespace std;
int main() {
long a;
cin >> a;
for (long i = 2; i * i <= a; ++i)
while (a % i == 0) {
cout << i << ' ';
a /= i;
}
if (a > 1) cout << a << ' ';
return 0;
}
using namespace std;
int main() {
long a;
cin >> a;
for (long i = 2; i * i <= a; ++i)
while (a % i == 0) {
cout << i << ' ';
a /= i;
}
if (a > 1) cout << a << ' ';
return 0;
}