简介
简单, 但是, 输出的格式有点错乱
code
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
long s;
cin >> s;
while(s != 1) {
int i;
for(i=2; i<=sqrt(s); ){
if(s % i == 0) {
s /= i;
cout << i << " ";
continue;
}
i++;
}
//cout << i << " " << (int)sqrt(s) << endl;
if(i == (int)sqrt(s)+1 && s != 1){
cout << s << " ";
s = 1;
}
}
cout << endl;
}