| ||||||||||
| 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...自己测了很多没发现错误#include <iostream>
using namespace std;
int main()
{
int a,b,c,d,e,f,h;
cin>>a>>b>>c>>d>>e>>f;
while(a!=0||b!=0||c!=0||d!=0||e!=0||f!=0)
{
if(a>11*e)
a-=11*e;
else a=0;
if(b>5*d)
b-=5*d;
else
{
if(a>20*d-4*b)
a-=20*d-4*b;
else
a=0;
b=0;
}
if(c%4==0)
c=c/4;
else
{
if(c%4==1)
{
if(b>5)
{
b-=5;
if(a>7)
a-=7;
else a=0;
}
else
{
if(a>27-b*4)
a-=27-b*4;
else
a=0;
b=0;
}
}
if(c%4==2)
{
if(b>3)
{
b-=3;
if(a>6)
a-=6;
else a=0;
}
else
{
if(a>18-b*4)
a-=18-b*4;
else
a=0;
b=0;
}
}
if(c%4==3)
{
if(b>1)
{
b-=1;
if(a>5)
a-=5;
else a=0;
}
else
{
if(a>9-b*4)
a-=9-b*4;
else
a=0;
b=0;
}
}
c=c/4+1;
}
if(h=b%9==0)
b=b/9;
else
{
b=b/9+1;
if(a>36-4*h)
a-=36-4*h;
else
a=0;
}
if(a%36==0)
a=a/36;
else
a=a/36+1;
cout<<a+b+c+d+e+f<<endl;
cin>>a>>b>>c>>d>>e>>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