#include<iostream> #include<cstdio> #include<vector> using namespace std; int factorsum(int n) { int m, sum = 0; for (m = 1; m < n; ++m) { if (n % m == 0) sum += m; } return sum; } int main() { vector<int> vece;//完数 vector<int> vecg;//盈数 int n; for (n = 2; n <= 60; ++n) { if (factorsum(n) == n) vece.push_back(n); else if (factorsum(n) > n) vecg.push_back(n); } vector<int>::iterator it; printf("E:"); for (it = vece.begin(); it != vece.end(); ++it) { printf(" %d", *it); } printf("\n"); printf("G:"); for (it = vecg.begin(); it != vecg.end(); ++it) { printf(" %d", *it); } printf("\n"); return 0; }