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 90303109 at 2003-12-22 13:41:01 on Problem 1017
#include <stdio.h>
void main(){
	int t1,t2,t3,a[7],i,r=0;
	while(1){
		for(i=1; i<=6; i++){
			scanf ("%d", &a[i]);
		}
		if(a[1]+a[2]+a[3]+a[4]+a[5]+a[6]==0) break;
		r=a[6]+a[5]+a[4]+a[3]/4;
		t1=a[5]*11;
		t2=a[4]*5;
		t3=a[3]%4;
		switch (t3){
		case 0:break;
		case 1:t2=t2+5;t1=t1+7;r++;break;
		case 2:t2=t2+3;t1=t1+6;r++;break;
		case 3:t2++;t1=t1+5;r++;break;
		}
		if(t2>=a[2]){
			t1=t1+(t2-a[2])*4;
			if (t1<a[1]){
				a[1]=a[1]-t1;
				if(a[1]%16==0) r=r+a[1]/16;
				if(a[1]%16!=0) r=r+a[1]/16+1;
			}
		}
		if(a[2]>t2){
			a[2]=a[2]-t2;
			r=r+a[2]/9;
			t1=t1+36-(a[2]%9)*4;
			if (t1<a[1]){
				a[1]=a[1]-t1;
				if(a[1]%16==0) r=r+a[1]/16;
				if(a[1]%16!=0) r=r+a[1]/16+1;
			}
		}
		printf("%d\n",r);
	}
}

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