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