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 |
要细心才能过啊!!这么简单,交了N次,终于过了~~~~#include <iostream.h> long a[9],sum; void main() { int i,k; for(i=1;i<=6;i++) { cin>>a[i]; if (a[i]) k=1; if (a[i]<0) a[i]=0; } while (k) { k=0; sum=a[6]+a[5]+a[4]; a[1]=a[1]-11*a[5]; a[2]=a[2]-5*a[4]; if (a[2]<0) a[1]=a[1]+4*a[2]; sum=sum+a[3]/4; a[3]=a[3]%4; if (a[3]>0) sum++; if (a[3]==1) { if (a[2]<0) a[2]=0; a[2]-=5; if (a[1]>0) a[1]=a[1]-7; if (a[2]<0) a[1]=a[1]+a[2]*4; if (a[1]<0) a[1]=0; } else if (a[3]==2) { if (a[2]<0) a[2]=0; a[2]-=3; if (a[1]>0) a[1]=a[1]-6; if (a[2]<0) a[1]=a[1]+a[2]*4; } else if (a[3]==3) { if (a[2]<0) a[2]=0; a[2]-=1; if (a[1]>0) a[1]=a[1]-5; if (a[2]<0) a[1]=a[1]+a[2]*4; } if (a[2]>0) { sum=sum+a[2]/9; a[2]=a[2]%9; if (a[2]>0) { sum++; a[1]=a[1]-36+4*a[2]; } } if (a[1]>0) { sum=sum+a[1]/36; if (a[1]%36!=0) sum++; } cout<<sum<<endl; for(i=1;i<=6;i++) { cin>>a[i]; if (a[i]) k=1; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator