Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

纪念PE

Posted by xuesu at 2014-03-19 00:33:08 on Problem 1528
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator