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<stdio.h> int main() { int a[6],s,s1,s2,t; while(1) { s=s1=s2=0; 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; } s=a[5]+a[4]+a[3]; s1=11*a[4]; s2=5*a[3]; s=s+(int)(a[2]/4.0+0.9); t=((int)(a[2]/4.0+0.9))*4-a[2]; if( t==1 ) { s2=s2+1; s1=s1+5; } else if(t==2) { s2=s2+3; s1=s1+6; } else if(t==3) { s2=s2+5; s1=s1+7; } if(s2>=a[1]) { s1=s1+2*(s2-a[1]); } else { s=s+(int)((a[1]-s2)/9.0+0.9); t=(int)((a[1]-s2)/9.0+0.9)*9-a[2]; s1=s1+4*t; } if(s1>=a[0]) { printf("%d\n",s); } else { s=s+(int)((a[0]-s1)/36.0+0.99); printf("%d\n",s); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator