文章
17
粉丝
177
获赞
2
访问
118.7k
#include<stdio.h>
#include<math.h>
int main()
{
int fin[100], fin_l = 0;
int full[100], full_l = 0;
for(int i = 2;i <= 60;i++)
{
int sum = 1;
for(int j = 2;j <= sqrt(i);j++)
{
if(i % j == 0){
if(i / j == j) sum += j;
else sum += j + i / j;
}
}
if(sum == i) fin[fin_l++] = i;
else if(sum > i) full[full_l++] = i;
}
printf("E: ");
printf("%d", fin[0]);
for(int i = 1;i < fin_l;i++)
printf(" %d", fin[i]);
printf("\n");
printf("G: ");
printf("%d", full[0]);
for(int i = 1;i < full_l;i++)
printf(" %d", full[i]);
printf("\n");
}
登录后发布评论
暂无评论,来抢沙发