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 |
大家帮帮忙啊!总是wa#include<stdio.h> void main() { int a[6]={0},count=0,i; scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]); while(1) { count=a[5]+a[4]+a[3]; a[0]=a[0]-a[4]*11; if(a[1]>a[3]*5) { a[1]=a[1]-a[3]*5;a[3]=0; } else { a[3]=a[3]*5-a[1];a[1]=0; } if(a[0]>a[3]) { a[0]=a[0]-a[3]*4; } else a[0]=0; if(a[2]%4==0&&a[2]!=0) { count+=a[2]/4; a[2]=0; } else if(a[2]/4>0) { count+=a[2]/4; a[2]=a[2]%4; } if(a[2]>0) { count++; if(4-a[2]==1) { if(a[1]>0) { a[1]--; a[0]-=2; } else if(a[0]>0) a[0]=a[0]-9; } else if((4-a[2])==2) { if(a[1]>=3) { a[1]-=3; a[0]-=6; } else { a[0]=a[0]-(3-a[1])*4-6; a[1]=0; } } else { if(a[1]>=5) { a[1]-=5; a[0]-=7; } else { a[0]=a[0]-(5-a[1])*4-7; a[1]=0; } } } if(a[1]%9==0&&a[1]!=0) { count+=a[1]/9; a[1]=0; } else if(a[1]/9>0) { count+=a[1]/9; a[1]=a[1]%9; } if(a[1]>0) { count++; a[0]=a[0]-(9-a[1])*4; } if(a[0]>0) { count+=a[0]/36; if(a[0]%36!=0) count++; } printf("%d\n",count); scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]); if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0) break; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator