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 |
help!!!#include<iostream.h> int a[2001][7]; int chuli(int i) { int geshu[7]; int sheng[6]; int yu4=0,j; int ans=0; geshu[6]=a[i][6]; geshu[5]=a[i][5]; if(geshu[5]*11>=a[i][1]) sheng[1]=0; else sheng[1]=a[i][1]-11*geshu[5]; geshu[4]=a[i][4]; if(geshu[4]*5>a[i][2]) { sheng[2]=0; yu4=geshu[4]*5-a[i][2]; } else sheng[2]=a[i][2]-5*geshu[4]; if(sheng[2]<0) sheng[2]=0; sheng[3]=a[i][3]%4; if(sheng[3]==0) geshu[3]=a[i][3]/4; else geshu[3]=a[i][3]/4+1; if((sheng[1]>0)&&(sheng[2]==0)) sheng[1]=sheng[1]-4*yu4; if(sheng[1]<=0) sheng[1]=0; if(sheng[3]==1) { if(sheng[2]>=5) { sheng[2]=sheng[2]-5; sheng[1]=sheng[1]-7; if(sheng[1]<0) sheng[1]=0; } else { sheng[1]=sheng[1]-(5-sheng[2])*4-7; if(sheng[1]<0) sheng[1]=0; sheng[2]=0; } } if(sheng[3]==2) { if(sheng[2]>=3) { sheng[2]=sheng[2]-3; sheng[1]=sheng[1]-6; if(sheng[1]<0) sheng[1]=0; } else { sheng[1]=sheng[1]-(3-sheng[2])*4-6; if(sheng[1]<0) sheng[1]=0; sheng[2]=0; } } if(sheng[3]==3) { if(sheng[2]>=1) { sheng[2]=sheng[2]-1; sheng[1]=sheng[1]-5; if(sheng[1]<0) sheng[1]=0; } else { sheng[1]=sheng[1]-9; if(sheng[1]<0) sheng[1]=0; } } if((sheng[1]>0)||(sheng[2]>0)) { if((sheng[1]+sheng[2]*4)%36==0) geshu[2]=(sheng[1]+sheng[2]*4)/36; else geshu[2]=(sheng[1]+sheng[2]*4)/36+1; } for(j=6;j>=2;j--) { if(geshu[j]>0) ans=ans+geshu[j]; } return ans; } void main() { int i,j; int n=0; for(i=1;i<=2000;i++) { n++; for(j=1;j<=6;j++) cin>>a[i][j]; if((a[i][1]==0)&&(a[i][2]==0)&&(a[i][3]==0)&& (a[i][4]==0)&&(a[i][5]==0)&&(a[i][6]==0)) break; } n--; for(j=1;j<=n;j++) cout<<chuli(j)<<endl; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator