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 |
修改了一下,就成了OLE,天啊,怎么会这样的?In Reply To:收集大家提供的测试数据,结果如下 Posted by:yzx at 2007-05-16 14:33:36 #include <stdio.h> char d[4]={0,1,3,5}; int a[6]; int main() { int i; int sum; int n; int left; freopen("1017.in","r",stdin); while(1) { sum = 0; n = 0; for(i = 0;i < 6;i++) { scanf("%d", a + i); sum += a[i]; } if(sum == 0) { break; } n += a[5]; n += a[4]; left = 11 * a[4]; if(a[0] > 0) { if(a[0] <= left) { a[0] = 0; } else { a[0] -= left; } } n += a[3]; left = 5 * a[3]; if(left > 0) { if(a[1] > 0) { if(a[1] <= left) { left -= a[1]; a[1] = 0; } else { a[1] -= left; left = 0; } } } left *= 4; if(left > 0) { if(a[0] > 0) { if(a[0] <= left) { a[0] = 0; } else { a[0] -= left; } } } n += a[2] / 4; left = a[2] % 4; if(left > 0) { n += 1; left = 4 - left; if(a[1] > 0) { if(a[1] <= d[left]) { left = 9 * left - 4 * a[1]; a[1] = 0; } else { a[1] -= d[left]; left = 9 * left - 4 * d[left]; } } else { left *= 9; } if(a[0] > 0) { if(a[0] <= left) { a[0] = 0; } else { a[0] -= left; } } } n += a[1] / 9; left = a[1] % 9; if(left > 0) { n += 1; left = 4 * (9 - left); if(a[0] > 0) { if(a[0] <= left) { a[0] = 0; } else { a[0] -= left; } } } n += a[0] / 36; left = a[0] % 36; if(left != 0) { n += 1; } printf("%d\n", n); } return 0; } /* #include<iostream.h> void main() { int a[7],sum; cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]; while(a[1]!=0||a[2]!=0||a[3]!=0||a[4]!=0||a[5]!=0||a[6]!=0) { sum=0; if(a[5]!=0) { sum+=a[5]; if(a[1]>0) a[1]=a[1]-11*a[5]; if(a[1]<0) a[1]=0; } if(a[4]!=0) { sum+=a[4]; if(a[1]>0) { if(a[4]*5-a[2]>0) a[1]=a[1]-4*(a[4]*5-a[2]); if(a[1]<0) a[1]=0; } if(a[2]>0) a[2]=a[2]-5*a[4]; if(a[2]<0) a[2]=0; } if(a[3]!=0) { sum+=a[3]/4; if(a[3]%4!=0) sum++; if(a[1]>0) if(a[3]%4!=0) { if(a[3]%4==1) if(a[2]<=5) a[1]=a[1]-27-a[2]*4; else a[1]=a[1]-7; if(a[3]%4==2) if(a[2]<=3) a[1]=a[1]-18-a[2]*4; else a[1]=a[1]-6; if(a[3]%4==3) if(a[2]<=1) a[1]=a[1]-9-a[2]*4; else a[1]=a[1]-5; } if(a[1]<0) a[1]=0; if(a[2]>0) if(a[3]%4!=0) { if(a[3]%4==1) a[2]=a[2]-5; else if(a[3]%4==2) a[2]=a[2]-3; else a[2]=a[2]-1; } if(a[2]<0) a[2]=0; } if(a[2]!=0) { sum+=a[2]/9; if(a[2]%9!=0) sum++; if(a[1]>0) if(a[2]%9!=0) a[1]=a[1]-36+4*(a[2]%9); if(a[1]<0) a[1]=0; } if(a[1]!=0) { sum+=a[1]/36; if(a[1]%36!=0) sum++; } cout<<sum<<endl; cin>>a[1]>>a[2]>>a[3]>>a[4]>>a[5]>>a[6]; } } */ Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator