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了一次,发现打错一个地方,再提交AC……

Posted by dashashi at 2009-12-09 15:27:10 on Problem 1017
贴上代码~

#include <iostream>

using namespace std;

int main()
{
	int a, b, c, d, e, f, ans;
	while(1)
	{
		cin >> a >> b >> c >> d >> e >> f;
		ans = 0;
		if (a+b+c+d+e+f == 0)
			break;
		ans += f;
		if (e > 0)
		{
			ans += e;
			a -= 11*e;
		}
		if (d > 0)
		{
			ans += d;
			b -= 5*d;
		}
		if (c > 0)
		{
			ans += c / 4;
			c = c % 4;
			switch(c)
			{
			case 0:	break;
			case 1:	ans++; b-=5; a-=7;break;
			case 2:	ans++; b-=3; a-=6;break;
			case 3: ans++; b-=1; a-=5;break;
			}
		}
		if (b < 0)
			a += b*4;
		else if (b > 0)
		{
			ans += b/9;
			b = b % 9;
			if (b != 0)
			{
				ans ++;
				a -= (36-b*4);
				b = 0;
			}
		}
		if (a > 0)
		{
			ans += a/36;
			a = a% 36;
			if (a != 0)
				ans++;
		}
		cout << ans << 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