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的程序随机产生了100组数据,都一样,这里的所有数据都已经测过,还是WA,求大牛#include"iostream" using namespace std; int main() { int a,b,c,d,e,f,res; while(cin>>f>>e>>d>>c>>b>>a) { if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0) break; res=a; res+=b; if(b*11>f) f=0; else f=f-11*b; res+=c; if(c*5>e) { f=f-4*(5*c-e); e=0; if(f<0) f=0; } else { e=e-5*c; } if(d%4==0) res+=d/4; else { res+=d/4; res=res+1; int k=4-d%4; if(k==1) { if(e>0) e--,f=f-5; else f=f-9; } if(k==2) { if(e>2) e=e-3,f=f-6; else f=f-(18-4*e); } if(k==3) { if(e>4) e=e-5,f=f-7; else f=f-(27-4*e); } } if(f<0) f=0; if(e<0) e=0; if(e>0) { if(e%9==0) res+=e/9; else { res+=e/9; res=res+1; f=f-(36-4*(e%9)); } } if(f<0) f=0; if(f>0) {if(f%36==0) res+=f/36; else res=res+f/36,res=res+1; } cout<<res<<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