题解 | #质数因子#

质数因子

http://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607

include <bits/stdc++.h>

using namespace std;
int main(){
long n;
while(cin>>n){
string res;
int i=2;
while(i<=n){
if(n%i==0){
res=res+to_string(i)+' ';
n=n/i;
}
else{
i++;
if(i%2==0){
i++;
}
}
}
cout<<res<<endl;
}
return 0;
}

全部评论
挑战c++最慢速度
点赞 回复
分享
发布于 2021-08-09 16:42

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务