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 30443 at 2011-07-22 22:44:53 on Problem 1017
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
	long int i,j,a[7],x,sum;
	for (;;)
	{	sum=0;
		x=0;
		scanf("%ld%ld%ld%ld%ld%ld",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6]);
		if(a[1]==0 && a[2]==0&& a[3]==0 && a[4]==0 && a[5]==0 && a[6]==0)
		break;
		sum+=a[6];
		sum+=a[5];   //先放5X5
		if(a[1]>11*a[5])
		a[1]=a[1]-a[5]*11;
		else a[0]=0;
		sum+=a[4];   //放4*4
		if(a[2]<=a[4]*5)  //考虑2*2
		{a[2]=0;
		if(a[2]<a[4]*5 && a[1]>0)
		{a[1]=a[1]-(a[4]*5-a[2]);
		if(a[1]<=0)
		a[1]=0;}}
		else a[2]-=a[4]*5;
		if(a[3]%4==0)  //放3*3
		sum+=a[3]/4;
		else 
		{	sum++;
			x=2*((a[3]/4+1)*4-a[3])-1;
			if(a[2]>0)
			{
				if(a[2]>=x)
				a[2]-=x;
				else 
				{a[2]=0;
				if(a[1]>=(36-a[3]%4*9-x*4))
				a[1]=a[1]-(36-a[3]%4*9-x*4);
				else a[1]=0	;
				}
			}
			else
			{if(a[1]>(36-a[3]%4*9))
				a[1]-=(36-a[3]%4*9);
				else a[1]=0;
			}
		}
		if(a[2]>0)   //放2*2
		sum+=a[2]/9;
		if(a[2]%9==0)
		a[2]=0;
		else 
		{sum++;
		if(a[1]<=(36-(a[2]%9)*4))
		a[1]=0;
		else a[1]=a[1]-(36-(a[2]%9)*4);
		}
		if(a[1]>0)
		sum=a[1]/36+1;
		printf("%ld\n",sum);
		
	}
	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