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

哎 解法很不好,不过还是AC把上面的程序中的一个小错误改下就可以了,谢谢那个1000组的数据!程序如下:

Posted by 0807012127 at 2010-12-16 23:30:25 on Problem 1017
In Reply To:大家帮帮忙啊!总是wa Posted by:0807012127 at 2010-12-16 22:55:11
> #include<stdio.h>
> void main()
> {
> 	int a[6]={0},count=0,i;
> 	
> 	scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);
> 	while(1)
> 	{ 
> 	  count=a[5]+a[4]+a[3];
>       a[0]=a[0]-a[4]*11;
>       if(a[1]>a[3]*5)
> 	  {
> 	    a[1]=a[1]-a[3]*5;a[3]=0;
> 	  }
> 	  else 
> 	  {
> 		  a[3]=a[3]*5-a[1];a[1]=0;
> 	  }
> 	  if(a[0]>a[3])
> 	  {
> 		  a[0]=a[0]-a[3]*4;
> 	  }
> 	  else a[0]=0;
> 	  if(a[2]%4==0&&a[2]!=0) 
> 	  {
> 	    count+=a[2]/4;
> 		a[2]=0;
> 	  }
> 	  else if(a[2]/4>0)
> 	  {
> 	    count+=a[2]/4;	
> 		a[2]=a[2]%4;
> 	  }
> 	  if(a[2]>0)
> 	  {
> 	    count++;
> 		if(4-a[2]==1)
> 		{
> 			if(a[1]>0)
> 			{
> 			  a[1]--;
> 			  a[0]-=5;
> 			}
> 			else if(a[0]>0)
> 			  a[0]=a[0]-9;
> 		}
> 		else if((4-a[2])==2)
> 		{
> 			if(a[1]>=3)
> 			{
> 			  a[1]-=3;
> 			  a[0]-=6;
> 			}
> 			else
> 			{
> 			  a[0]=a[0]-(3-a[1])*4-6;
> 			  a[1]=0;
> 			}
> 		}
> 		else 
> 		{
> 			if(a[1]>=5)
> 			{
> 		      a[1]-=5;
> 		      a[0]-=7;
> 			}
> 			else 
> 			{
> 			  a[0]=a[0]-(5-a[1])*4-7;
> 			  a[1]=0;
> 			}
> 		}
> 	  }
>       if(a[1]%9==0&&a[1]!=0)
> 	  {
> 	    count+=a[1]/9;
> 		a[1]=0;
> 	  }
> 	  else if(a[1]/9>0)
> 	  {
> 	    count+=a[1]/9;
> 		a[1]=a[1]%9;
> 	  }
> 	  if(a[1]>0)
> 	  {
> 	    count++;
> 		a[0]=a[0]-(9-a[1])*4;
> 	  }
>       if(a[0]>0)
> 	  {
> 	    count+=a[0]/36;
> 		if(a[0]%36!=0)
>         count++;
> 	  }
> 	  printf("%d\n",count);
> 	  scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]);
>       if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0) break;
> 	}
> }

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