| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
纯模拟……WA了一次,发现打错一个地方,再提交AC……贴上代码~
#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator