这真是一道最令人烦躁的题......
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int print(vector<int>v){
printf("%d",v[0]);int i;
for(i=1;i<v.size();i++)
printf("% d",v[i]);
return 0;
}
int main(){
vector<int>wanshu;
vector<int>yingshu;
vector<int>factor;
int x;
for(x=1;x<=60;x++){
int sum=0;
factor.clear();
for(int i=1;i<x;i++)
if(x%i==0)
factor.push_back(i);
for(int i=0;i<factor.size();i++)
sum+=factor[i];
if(sum==x)wanshu.push_back(x);
else if(sum>x)yingshu.push_back(x);
}
printf("E: ");
print(wanshu);
printf("\n");
printf("G: ");
print(yingshu);
return 0;
}