//土尔逊Torson 编写于2023/4/26 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <vector> using namespace std; vector<int> numberE; //完数 vector<int> numberG; //盈数 int Sum(int x) { int sum = 0; for (int i = 1; i < x; ++i) { if (x % i == 0) { sum += i; } } return sum; } int main() { for (int i = 2; i <= 60; ++i) { if (i == Sum(i)) { numberE.push_back(i); } else if (i < Sum(i)) { numberG.push_back(i); } } printf("E:"); for (unsigned int i = 0; i < numberE.size(); ++i) { printf(" %d", numberE[i]); } printf("\n"); printf("G:"); for (unsigned int i = 0; i < numberG.size(); ++i) { printf(" %d", numberG[i]); } printf("\n"); system("pause"); return EXIT_SUCCESS; } // 64 位输出请用 printf("%lld")