Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
好吧, 新手我对齐对了好久,终于对齐了,1ac,0ms,呵呵#include <iomanip> #include <iostream> using namespace std; int main() { int n; cout<<"PERFECTION OUTPUT"<<endl; while(cin>>n) { if(n==0){cout<<"END OF OUTPUT"<<endl;break;} if(n==1){cout<<setw(5)<<1<<" DEFICIENT"<<endl;continue;} int stop=n,sum=1; for(int i=2;i<=n && i<stop;++i) { if(n%i)continue; stop=n/i; sum+=i+stop; } if(sum==n)cout<<setw(5)<<n<<" "<<"PERFECT"<<endl; else if(sum<n)cout<<setw(5)<<n<<" "<<"DEFICIENT"<<endl; else cout<<setw(5)<<n<<" "<<"ABUNDANT"<<endl; } system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator