文章
84
粉丝
408
获赞
33
访问
877.1k
注意输出格式
#include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int> ve;
vector<int> vg;
for (int num = 2; num <= 60; num++) {
int tmp = 0;
for (int i = 1; i < num; i++) {
if (num%i == 0) {
tmp += i;
}
}
if (tmp == num)
ve.push_back(num);
else if (tmp > num)
vg.push_back(num);
}
cout << "E:";
for (int i = 0; i < ve.size(); i++)
cout << " " << ve[i];
cout << " G:";
for (int i = 0; i < vg.size(); i++)
cout << " " << vg[i];
cout << endl;
}
登录后发布评论
暂无评论,来抢沙发