文章
35
粉丝
134
获赞
55
访问
25.4k
#include <bits/stdc++.h>
using namespace std;
int main(){
int N,sum;
cin>>N;
for(int i=2;i<=N;i++){
sum=0;
vector<int> factor;
for(int j=1;j<i;j++){
if(i%j==0) {
sum+=j;
factor.push_back(j);
}
}
if(i==sum) {
cout<<i<<" its fastors are";
for(int k=0;k<factor.size();k++){
cout<<" "<<factor[k];
}
cout<<endl;
}
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发