https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5096
#include <stdio.h>
#include <string.h>
using namespace std;
int main(void){
int n, t, s, i;
scanf("%d", &n);
while (n--){
scanf("%d", &t);
s = 0;
for (i = 1; i < t; i++){
if(t % i == 0)
s = s + i;
}
if( s < t)
printf("deficient\n");
else if (s == t)
printf("perfect\n");
else
printf("abundant\n");
}
return 0;
}
留言列表