| ||||||||||
| 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 | |||||||||
终于AC了 纠结了好久。。。附代码#include<cstdio>
using namespace std;
int main()
{
int a,b,c,d,e,f;
while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)&&(a||b||c||d||e||f))
{
if(11*e>=a)
a=0;
else
a-=11*e;
f+=e;
if(5*d<b)
b-=5*d;
else
{
a-=d*36-d*16-b*4;
b=0;
if(a<0)
a=0;
}
f+=d;
f+=c/4;
c-=c/4*4;
if(c!=0)
{
if(c==3)
{
a-=(4-c)*5;
b-=(4-c);
}
else if(c==2)
{
if(b>=3)
{
b-=3;
a-=6;
}
else
{
a-=(3-b)*4+6;
b=0;
}
}
else
{
if(b>=5)
{
b-=5;
a-=7;
}
else
{
a-=(4-b)*4+11;
b=0;
}
}
if(a<0)
a=0;
if(b<0)
b=0;
f++;
}
f+=b/9;
b-=b/9*9;
if(b!=0)
{
a-=36-b*4;
if(a<0)
a=0;
f++;
}
f+=(a%36==0?a/36:a/36+1);
printf("%d\n",f);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator