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

大哥大姐,救救我吧!!!小弟混不下去了!!

Posted by 00448116 at 2005-03-23 09:42:11 on Problem 1017
#include <iostream.h>
#include <math.h>
void main()
{
	int str[6];
	for(int i=0;i<6;i++)
		str[i]=0;
	for(int j=0; ;j++)
	{
		for(i=0;i<6;i++)
			cin>>str[i];
		if(str[0]==0&&str[1]==0&&str[2]==0&&str[3]==0&&str[4]==0&&str[5]==0)
			break;
		int num=0;
		if(str[2]==0)
			num=str[5]+str[4]+str[3];
		if((str[2]>=1)&&(str[2]<=4))
			num=str[5]+str[4]+str[3]+1;
		if(str[2]>4)
			num=str[5]+str[4]+str[3]+(int)ceil((double)str[2]/4);


		if(str[3]!=0)
		{
			if(str[1]<=5*str[3]) 
			{}
			if(str[1]>5*str[3])
			{
				int a=0;
				a=str[1]-5*str[3];

				if(str[2]==0||((str[2]%4==0)&&(str[2]>4)))
					num+=(int)ceil((double)a/9);
				if(str[2]==1||((str[2]>4)&&(str[2]%4==1)))
				{
					if(a<=5) ;
					else num+=(int)ceil((double)(a-5)/9);
				}
				if(str[2]==2||((str[2]>4)&&(str[2]%4==2)))
				{
					if(a<=3) ;
					else num+=(int)ceil((double)(a-3)/9);
				}
				if(str[2]==3||((str[2]>4)&&(str[2]%4==3)))
				{
					if(a==1) ;
					else num+=(int)ceil((double)(a-1)/9);
				}
			}
			int leftSpace=0;
			leftSpace=36*num-(36*str[5]+25*str[4]+16*str[3]+9*str[2]+4*str[1]);
			if(str[0]<=leftSpace) ;
			else num+=(int)ceil((double)(str[0]-leftSpace)/36);
		}



		if(str[3]==0)
		{
                if(str[2]==0||((str[2]%4==0)&&(str[2]>4)))
					num+=(int)ceil((double)str[1]/9);
				if(str[2]==1||((str[2]>4)&&(str[2]%4==1)))
				{
					if(str[1]<=5) ;
					else num+=(int)ceil((double)(str[1]-5)/9);
				}
				if(str[2]==2||((str[2]>4)&&(str[2]%4==2)))
				{
					if(str[1]<=3) ;
					else num+=(int)ceil((double)(str[1]-3)/9);
				}
				if(str[2]==3||((str[2]>4)&&(str[2]%4==3)))
				{
					if(str[1]==1) ;
					else num+=(int)ceil((double)(str[1]-1)/9);
				}
			
			int leftSpace=36*num-(36*str[5]+25*str[4]+16*str[3]+9*str[2]+4*str[1]);
			if(str[0]<=leftSpace) ;
			else num+=(int)ceil((double)(str[0]-leftSpace)/36);
		}

		cout<<num<<endl;
	}
}        























































































		
	

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