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.h> void func(int box[]) { int sub=0; int num[3]={0,0,0}; sub+=box[5]+box[4]+box[3]; num[0]+=box[4]*11; num[1]+=box[3]*5; sub+=box[2]/4; if(box[2]%4!=0) { sub++; if(box[2]%4==1) { num[1]+=4; num[0]+=11; } if(box[2]%4==2) { num[1]+=3; num[0]+=6; } if(box[2]%4==1) { num[1]+=1; num[0]+=5; } } if(box[1]>num[1]) { sub+=(box[1]-num[1])/9; if((box[1]-num[1])%9!=0) { sub++; num[0]+=36-(box[1]-num[1])%9*4; } } else { num[0]+=(num[1]-box[1])*4; } if(box[0]>num[0]) { sub+=(box[0]-num[0])/36; if((box[0]-num[0])%36!=0) sub++; } cout<<sub<<endl; } void main() { int box[6]; while(1) { int logic=0; for(int i=0;i<=5;i++) { cin>>box[i]; logic+=box[i]; } if(logic==0) break; else func(box); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator