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 |
请大家帮我查错,数据测试正确,就是能不过,万分感激。好心人帮帮我啊。#include<iostream> #include<math.h> using namespace std; int main() { int a1=0,a2=0,a3=0,a4=0,a5=0,a6=0,a61=0,a62=0,a63=0,a64=0,a65=0,a66=0,sum=0; while(scanf("%d%d%d%d%d%d",&a1,&a2,&a3,&a4,&a5,&a6)==6) {if(a1==0&&a2==0&&a3==0&&a4==0&&a5==0&&a6==0){cout<<endl;break;} if(a6>0) a66=a6; else a66=0;//cout<<"a6 is "<<a6<<endl; if(a5>0) { a65=a5; if(a1>=a5*11) a1=a1-11*a5; else a1=0; }//cout<<"a5 is "<<a5<<endl; if(a4>0) { a64=a4; if(a2>=a4*5) a2=a2-5*a4; else { if(a1>=20*a4-a2*4) a1=a1-(20*a4-a2*4); else a1=0; a2=0; } }//cout<<"a4 is "<<a4<<endl; if(a3>0&&a3%4!=0) { a63=a3/4+1; if(a3%4==3) { if(a2>0) { a2=a2-1; if(a1>=5) a1=a1-5; else a1=0; } else { if(a1>=9) a1=a1-9; else a1=0; a2=0; } } } if(a3%4==2) { if(a2>=2) { a2=a2-2; if(a1>=10) a1=a1-10; else a1=0; } else { if(a1>=18-4*a2) a1=a1-(18-4*a2); else a1=0; a2=0; } } if(a3%4==1) { if(a2>=5) { a2=a2-5; if(a1>=7) a1=a1-7; else a1=0; } else { if(a1>=27-4*a2) a1=a1-(27-4*a2); else a1=0; a2=0; } } if(a3>0&&a3%4==0) a63=a3/4;//cout<<"a3 is "<<a3<<endl; if(a2>0&&a2%9!=0) { a62=a2/9+1; if(a2%9==8) {if(a1>=4) a1=a1-4;else a1=0;} if(a2%9==7) {if(a1>=8) a1=a1-8;else a1=0;} if(a2%9==6) {if(a1>=12) a1=a1-12;else a1=0;} if(a2%9==5) {if(a1>=16) a1=a1-16;else a1=0;} if(a2%9==4) {if(a1>=20) a1=a1-20;else a1=0;} if(a2%9==3) {if(a1>=24) a1=a1-24;else a1=0;} if(a2%9==2) {if(a1>=28) a1=a1-28;else a1=0;} if(a2%9==1) {if(a1>=32) a1=a1-32;else a1=0;} } if(a2>0&&a2%9==0) a62=a2/9;//cout<<"a2 is "<<a2<<endl; if(a1>0&&a1%36!=0) a61=a1/36+1; else a61=a1/36;//cout<<"a1 is "<<a1<<endl; sum=a61+a62+a63+a64+a65+a66; cout<<sum<<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