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