| ||||||||||
| 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 | |||||||||
小菜水过四十题留念。。#include<stdio.h>
int main()
{
int i,n,temp,k,sum;
int a[1000],count=0;
while(1)
{
sum=0;
scanf("%d",&n);
if(count==0)
printf("PERFECTION OUTPUT\n");
count++;
k=0;
if(n==0)
{
printf("END OF OUTPUT\n");
break;
}
temp=n/2;
for(i=2;i<temp;i++)
{
if(n%i==0)
{
a[k]=i;
if(i!=n/i)
a[++k]=n/i;
k++;
temp=n/i;
}
}
for(i=0;i<k;i++)
sum+=a[i];
if(n!=1) sum=sum+1;
if(sum==n)
printf("%5d PERFECT\n",n);
if(sum<n)
printf("%5d DEFICIENT\n",n);
if(sum>n)
printf("%5d ABUNDANT\n",n);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator