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 |
请帮忙看一下这个程序,为什么总wrong#include"stdio.h" void main() { int n;//箱子的个数 int m,i,k1,k2; int size[6]; for(i=0;i<6;i++) { scanf("%d",&size[i]); } while(size[0]!=0||size[1]!=0||size[2]!=0||size[3]!=0||\ size[4]!=0||size[5]!=0) { n=0; n=size[5]; n+=size[4]; k1=11*size[4];//put 1*1 product n+=size[3]; k2=5*size[3];//put 2*2 product n+=size[2]/4+1; m=size[2]%4; if(m==1) {k1+=7;k2+=5;} else if(m==2) {k1+=6;k2+=3;} else if(m==3) {k1+=4;k2+=1;} else n-=1; if(size[1]-k2>0) { n=n+(size[1]-k2)/9; if((size[1]-k2)%9!=0) { n=n+1; k1=36-(size[1]-k2)%9*4; } } if(size[0]-k1>0) { n+=(size[0]-k1)/36; if((size[0]-k1)%36!=0) n+=1; } printf("%d\n",n); for(i=0;i<6;i++) { scanf("%d",&size[i]); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator