poj_1528 Perfection
2013-05-22 19:30
561 查看
题目链接:http://poj.org/problem?id=1528
//C++代码 #include<iostream> #include<iomanip> using namespace std; int main(){ cout<<"PERFECTION OUTPUT"<<endl; int n,i; while(cin>>n,n){ if(n==1){ cout<<setw(5)<<n<<" DEFICIENT"<<endl; continue; } int sum=1; for(i=2;i*i<=n;i++){ if(n%i==0){ if(i*i==n) sum+=i; else sum+=i+n/i; } } if(sum<n) cout<<setw(5)<<n<<" DEFICIENT"<<endl; else if(sum==n) cout<<setw(5)<<n<<" PERFECT"<<endl; else cout<<setw(5)<<n<<" ABUNDANT"<<endl; } cout<<"END OF OUTPUT"<<endl; return 0; }
相关文章推荐
- ACM Computer Factory--POJ 3436
- POJ 1469 COURSES 解题报告
- POJ 2135 最小费用最大流
- POJ 1556
- poj 1200
- POJ题目分类推荐
- poj 2392 Space Elevator
- poj 2513Colored Sticks
- 树状数组 POJ 2481 Cows
- POJ 3628 Bookshelf 2
- POJ 3026 Borg Maze
- poj 2785
- POJ 1287 Networking(最小生成树)
- POJ 2318 (叉积) TOYS
- POJ 3225 (线段树 区间更新) Help with Intervals
- POJ 2823 Sliding Window 单调队列
- POJ 3744 Scout YYF I (概率dp+矩阵快速幂)
- POJ-3030
- POJ 1017 Packets (贪心)
- poj 8464 股票买卖(dp/分治)