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

WA······哪里出错了?

Posted by The_One at 2009-08-03 14:08:19 on Problem 1528
#include<stdio.h>

int main()
{
	int n,i,a[101]={0},j,k;
	long sum;
	
	j=0;
	while( scanf("%d",&n)!=EOF)
	{
		if( n==0 )
			break;
		a[j++]=n;
	}
	printf("PERFECTION OUTPUT\n");
	for( k=0; k<j; k++)
	{
		sum=0;
		for( i=1; i<=a[k]/2; i++)
		{
			if( a[k]%i==0 )
				sum+=i;
			if( sum>a[k] )
				break;
		}
		if( sum==a[k] )
			printf("% 5d  PERFECT\n",a[k]);
		if( sum<a[k] )
			printf("% 5d  DEFICIENT\n",a[k]);
		if( sum>a[k] ) 
			printf("% 5d  ABUNDANT\n",a[k]);	
	}
	printf("EDN 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