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 |
wrang了好多次 都没叫上去 哪位大牛帮我看看不?那一1000组数据好像都过了 #include<stdio.h> #include<iostream> using namespace std; int a[7]; int main() { while(scanf("%d%d%d%d%d%d",&a[1],&a[2],&a[3],&a[4],&a[5],&a[6])!=EOF) { if(a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0&&a[6]==0)break; int cnt=0; cnt+=a[6]; a[6]=0; cnt+=a[5]; a[1]-=a[5]*11; if(a[1]<0)a[1]=0; a[5]=0; cnt+=a[4]; a[2]-=a[4]*5; if(a[2]<0) { //a[2]=0; if(a[1]>0) { a[1]-=(-a[2])*4; if(a[1]<0)a[1]=0; } a[2]=0; } a[4]=0; int num; num=a[3]*9; if(num%36==0)cnt+=num/36; else { cnt+=num/36+1; int x=36-num%36; if(x==9) { if(a[2]>=1) { a[2]-=1;x-=4; a[1]-=x; if(a[1]<0)a[1]=0; } else { a[1]-=x; if(a[1]<0)a[1]=0; } a[3]=0; } else if(x==18) { if(a[2]<=3) { a[2]=0; x-=a[2]*4; a[1]-=x; if(a[1]<0)a[1]=0; } if(a[2]>3) { a[2]-=3; a[1]-=6; if(a[1]<0)a[1]=0; } a[3]=0; } else if(x==27) { if(a[2]>=5) { a[2]-=5; a[1]-=7; if(a[1]<0)a[1]=0; } if(a[2]<5) { a[2]=0; a[1]=a[1]-(5-a[2])*4-7; if(a[1]<0)a[1]=0; } a[3]=0; } } int y; y=a[2]*4; if(y%36==0) { cnt+=y/36; a[2]=0; } else { cnt+=y/36+1; y=36-y%36; a[1]-=y; if(a[1]<0)a[1]=0; a[2]=0; } y=a[1]; if(y%36==0)cnt+=y/36; else cnt+=y/36+1; printf("%d\n",cnt); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator