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 |
收集大家提供的测试数据,结果如下In Reply To:各位,给个BT的数据吧,我不要WA啊。 Posted by:yzx at 2007-05-16 00:24:28 Input: 0 0 4 0 0 1 7 5 1 0 0 0 36 9 4 1 1 1 0 9 4 1 1 0 0 0 4 0 0 0 36 0 0 0 0 0 0 9 0 0 0 0 79 96 94 30 18 14 53 17 12 98 76 54 83 44 47 42 80 3 15 26 13 29 42 40 41 61 36 90 54 66 78 56 445 45 23 65 13 4 8 29 45 3 15 75 45 98 34 53 40 9 0 2 0 0 41 9 0 2 0 0 44 0 0 0 4 0 0 2 3 0 0 0 37 7 2 0 1 0 12 2 0 1 0 0 13 2 0 1 0 0 0 0 0 0 0 0 Output: 2 1 6 4 1 1 1 86 231 137 115 219 245 79 197 3 4 4 2 3 1 2 ====== 不知道为什么还是WA,大家帮我看下是怎么回事 #include <stdio.h> char d[4]={0,5,3,1}; int a[6]; int main() { int i; int sum; int n; int left; 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] <= left) { a[0] = 0; } else { a[0] -= left; } n += a[3]; left = 5 * a[3]; if(left > 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] <= left) { a[0] = 0; } else { a[0] -= left; } } n += a[2] / 4; left = a[2] % 4; if(left > 0) { n += 1; if(a[1] <= d[left]) { left = 27 * left - 4 * a[1]; a[1] = 0; } else { left = 27 * left - 4 * d[left]; a[1] -= d[left]; } if(a[0] <= left) { a[0] = 0; } else { a[0] -= left; } } n += a[1] / 9; left = 4 * (a[1] % 9); if(left > 0) { n += 1; 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; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator