範例程式碼 uva13185

//uva13185
#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;
}