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 Chen_Huajie at 2012-03-23 08:12:54 on Problem 1017
#include<stdio.h>
int main()
{
	int a[6],s,s1,s2,t;
	while(1)
	{
		s=s1=s2=0;	
		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;
		}
		s=a[5]+a[4]+a[3];
		s1=11*a[4];
		s2=5*a[3];
		s=s+(int)(a[2]/4.0+0.9);
		t=((int)(a[2]/4.0+0.9))*4-a[2];
		if(  t==1  )
		{
			s2=s2+1;
			s1=s1+5;
		}
		else if(t==2)
		{
			s2=s2+3;
			s1=s1+6;
		}
		else if(t==3)
		{
			s2=s2+5;
			s1=s1+7;
		}
		if(s2>=a[1])
		{
			s1=s1+2*(s2-a[1]);
		}
		else
		{
			s=s+(int)((a[1]-s2)/9.0+0.9);
			t=(int)((a[1]-s2)/9.0+0.9)*9-a[2];
			s1=s1+4*t;
		}
		if(s1>=a[0])
		{
			printf("%d\n",s);
		}
		else
		{
			s=s+(int)((a[0]-s1)/36.0+0.99);
			printf("%d\n",s);
		}
	}
	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