POJ 1528

Nothing to say

 

 

#include <iostream> using namespace std; int main() { int num[101]; int len = 0; for (int i = 0;i < 100;i++) { scanf("%d",&num[i]); if(num[i]==0) { len = i; break; } } cout<<"PERFECTION OUTPUT"<<endl; for (int i = 0;i < len;i++) { int result = 0; for (int j = 1;j <= num[i]/2;j++) { if(num[i]%j==0) result+=j; } printf("%5d",num[i]); if(result==num[i]) cout<<" PERFECT"<<endl; else if(result>num[i]) cout<<" ABUNDANT"<<endl; else cout<<" DEFICIENT"<<endl; } cout<<"END OF OUTPUT"<<endl; }

你可能感兴趣的:(POJ 1528)