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

要细心才能过啊!!这么简单,交了N次,终于过了~~~~

Posted by church at 2007-05-18 18:01:49 on Problem 1017
#include <iostream.h>
long a[9],sum;

void main()
{
	int i,k;
	for(i=1;i<=6;i++)
	{
		cin>>a[i];
		if (a[i])
			k=1;
		if (a[i]<0)
			a[i]=0;
	}
	while (k)
	{
		k=0;
		sum=a[6]+a[5]+a[4];
		a[1]=a[1]-11*a[5];
		a[2]=a[2]-5*a[4];
		if (a[2]<0)
			a[1]=a[1]+4*a[2];
		sum=sum+a[3]/4;
			
		a[3]=a[3]%4;
		if (a[3]>0)
			sum++;
		if (a[3]==1)
		{
			if (a[2]<0)
				a[2]=0;
			a[2]-=5;
			if (a[1]>0)
				a[1]=a[1]-7;
			if (a[2]<0)
				a[1]=a[1]+a[2]*4;
				  if (a[1]<0)
				  a[1]=0;
		}
		else
			if (a[3]==2)
			{
	          if (a[2]<0)
				a[2]=0;
		    	a[2]-=3;
		 	 if (a[1]>0)
				a[1]=a[1]-6;
			  if (a[2]<0)
				a[1]=a[1]+a[2]*4;
			 
			}
			else
				if (a[3]==3)
				{
					 if (a[2]<0)
				    a[2]=0;
		        	a[2]-=1;
		 	       if (a[1]>0)
		     		a[1]=a[1]-5;
			       if (a[2]<0)
				   a[1]=a[1]+a[2]*4;
				
				}
			if (a[2]>0)
			{
				sum=sum+a[2]/9;
				a[2]=a[2]%9;
				if (a[2]>0)
				{
					sum++;
				  a[1]=a[1]-36+4*a[2];
				}
			}
			if (a[1]>0)
			{
				sum=sum+a[1]/36;
				if (a[1]%36!=0)
					sum++;
			}
			cout<<sum<<endl;
	for(i=1;i<=6;i++)
	{
		cin>>a[i];
		if (a[i])
			k=1;
	}
	}

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