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 841034621 at 2010-08-03 10:15:19 on Problem 1014
#include<stdio.h>
int main()
{
	int a[7];
	int i,j,s,k=0;
	while(1)
	{
		for(i=1;i<=6;i++)
			scanf("%d",&a[i]);
		if(a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0)
			break;
		else
		{
            ++k;
			s=0;
			for(i=1;i<=6;i++)
			s+=i*a[i];
			if(s%2==1)
				printf("Collection #%d:\nCan't be divided.\n\n",k);
			else
			{
			int t=0;
			for(i=6;i>=1;i--)
			{
				for(j=0;j<=a[i];j++)
                   if((t+j*i)<=s/2)
					   t+=j*i;
				   else break;
			}
			if(t==s/2)
				printf("Collection #%d:\nCan be divided.\n\n",k);
			else
				printf("Collection #%d:\nCan't be divided.\n\n",k);
			}
		}
	}
	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