#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n,sum=0,a;
while(cin>>a){
for(int g=0;g<a;g++){
cin>>n;
for(int i=1;i<n;i++){
if(n%i==0){
sum+=i;
}
}
if(sum==n){
cout<<"perfect"<<endl;
}
else if(sum>n){
cout<<"abundant"<<endl;
}
else{
cout<<"deficient"<<endl;
}
}
}
return 0;
}
//如有誤,請高手指點
#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int n,sum=0,a;
while(cin>>a){
for(int g=0;g<a;g++){
cin>>n;
for(int i=1;i<n;i++){
if(n%i==0){
sum+=i;
}
}
if(sum==n){
cout<<"perfect"<<endl;
}
else if(sum>n){
cout<<"abundant"<<endl;
}
else{
cout<<"deficient"<<endl;
}
}
}
return 0;
}
糟糕,打錯了~少了一個SUM=0!!