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 wangzh at 2007-08-20 16:11:04 on Problem 1017
wa的代码是:
#include<iostream>
using namespace std;
int main()
{
	int a[6],sum;
	const int max=36;
	while(cin>>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;
	   sum=0;
	   
		sum+=a[5];
		for(int i5=0;i5<a[4];i5++)
		{
			sum+=1;

			for(int j=a[4]*25;j<max&&a[0]>0;)
			{
				j+=1;a[0]--;
			}
		}
		for(int i4=0;i4<a[3];i4++)
		{
			sum+=1;
			int j4=0;
			for(j4=a[3]*16;j4<max&&a[1];)
			{
				j4+=4;a[1]--;
			}
			if(j4<max&&a[0])
			{
				for(j4;j4<max&&a[0];)
				{
					j4+=1;a[0]--;
				}
			}
		}
	
		sum=sum+a[2]/4;
		a[2]=a[2]%4;
		if(a[2])
		{
			sum+=1;
            int j3=0;
			j3=a[2]*9;
			for(j3;j3<max&&a[1];)
			{
				j3+=4;a[1]--;
			}
			if(j3<max&&a[0])
			{
				for(j3;j3<max&&a[0];)
				{
					j3+=1;a[0]--;
				}
			}
		}
	
		sum+=a[1]/9;
		a[1]=a[1]%9;
		if(a[1])
		{
		sum+=1;
		int j2=0;
		j2=4*a[1];
		for(j2;j2<max&&a[0];)
		{
			j2+=1;a[0]--;
		}
		}
	
		sum+=a[0]/36;
		a[0]=a[0]%36;
		if(a[0]>0)sum+=1;
	
  cout<<sum<<endl;
	}
	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