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

Re:我真的受不了这wa了, 我试了多组数据, 没有错的……

Posted by 0044888888 at 2005-03-23 22:46:41 on Problem 1017
In Reply To:我真的受不了这wa了, 我试了多组数据, 没有错的…… Posted by:leoyonn at 2005-03-23 22:25:21
这样就好了
#include <iostream.h>
void main(){
	int nBox = 0, nSize[7], nEsc = 0, nRemain32, nRemain21;
	for(int i = 1; i <= 6; i++){
		cin >> nSize[i];
		if(nSize[i] > 0) nEsc ++;
	}
	while(nEsc !=0){
		nEsc = 0;
		nBox = 0;
		nBox += nSize[6] + nSize[5] + nSize[4];
		if(nSize[3] % 4 != 0){
			nBox += nSize[3] / 4 + 1;
			nRemain32 = (4 - nSize[3] % 4) * 2 - 1;
		}
		else{
		nBox += nSize[3] / 4;
		nRemain32 = 0;
		}
		if(nSize[2] > nSize[4] * 5 + nRemain32){
			int t = (nSize[2] - nSize[4] * 5 - nRemain32);
			nBox += (t % 9) ? (t / 9 + 1) : t / 9;
		}
		nRemain21 = (nBox - nSize[6]) * 36 - (nSize[5] * 25 + nSize[4] * 16 + nSize[3] * 9 + nSize[2] * 4);
		//cout<<nRemain21<<(nSize[1] - nRemain21)  <<endl;
		if(nSize[1] > nRemain21)
			nBox += ((nSize[1] - nRemain21) % 36) ?((nSize[1] - nRemain21) / 36 + 1) : (nSize[1] - nRemain21) / 36;
		cout << nBox << endl;
		for(int i = 1; i <= 6; i++){
			cin >> nSize[i];
			if(nSize[i] > 0) nEsc ++;
		}
	}
}



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