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

程序把1的情况忽略了。。。。现在改好了

Posted by skywhat at 2015-09-15 22:14:27 on Problem 1528
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>

using namespace std;

int main()
{
    int i,n,num;
    int flag=0;
    while(scanf("%d",&num)&&num)
    {
        int sum=1;
        
        if(num==1)
        {
            printf("%5d  DEFICIENT\n",num);
            continue;
        }
        
        n=num/2;
        for(i=2;i<n;++i)
        {
            if(num%i==0)
            {
                sum+=i;
                if(i!=num/i)
                    sum+=num/i;
                n=num/i;
            }
        }
        if(!flag)
            printf("PERFECTION OUTPUT\n");
        flag=1;
        printf("%5d  ",num);
        if(sum>num)
            printf("ABUNDANT\n");
        else if(sum==num)
            printf("PERFECT\n");
        else
            printf("DEFICIENT\n");
    }
    printf("END OF OUTPUT\n");
    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