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 |
纪念PE#include <stdio.h> using namespace std; int prime[60000]; int heap[60000]; int index; int main(){ int n,sum,power,m; prime[0]=prime[1]=1; for(int i=2;i<60000;i++){ if(!prime[i]){ heap[index++]=i; for(int j=i+i;j<60000;j+=i){ prime[j]=1; } } } printf("PERFECTION OUTPUT\n"); while(scanf("%d",&n)&&n) { sum=1; m=n; int num=0; int temp,th; for(int i=0;i<index&&m!=1;i++){ temp=sum; th=heap[i]; while(m%heap[i]==0&&m!=1){ num++; m/=heap[i]; sum+=temp*th; th*=heap[i]; } } sum-=n; if(sum==n)printf(" %5d PERFECT\n",n); else if(sum>n)printf(" %5d ABUNDANT\n",n); else printf(" %5d DEFICIENT\n",n); } printf("END OF OUTPUT"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator