文章
10
粉丝
179
获赞
33
访问
38.2k
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=1e9;
const int maxn=1e7+10;
int N=0,M=0,K=0;
string a,b;
int x,y;
int sum=0,ksum=0,cnt;
int wan[31],ying[31];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int lenw=0,leny=0;//分别记录完数和盈数数组的长度
for(int i=2;i<=60;i++){//暴力搜索将所有完数和盈数归类
sum=0;
for(int j=1;j<i;j++){
if(i%j==0) sum+=j;
}
if(sum==i) wan[lenw++]=i;
else if(sum>i) ying[leny++]=i;
}
//输出两组数
cout<<"E: ";
for(int i=0;i<lenw;i++) cout<<wan[i]<<" ";
cout<<endl;
cout<<"G: ";
for(int i=0;i<leny;i++) cout<<ying[i]<<" ";
cout<<endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发