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> #include <string.h> int main() { int pro[6] = {0}; int count = 0; while(1) { scanf("%d%d%d%d%d%d", &pro[0], &pro[1], &pro[2], &pro[3], &pro[4], &pro[5]); if(pro[0]+pro[1]+pro[2]+pro[3]+pro[4]+pro[5] == 0) break; else { int t = 0; int box[6][6] = {0}; count = pro[5]+pro[4]+pro[3]+(pro[2]+3)/4; t = 20*pro[3] - 4*pro[1]; pro[1] = t >= 0 ? 0 : pro[1] - 5*pro[3]; pro[0] = pro[0] <= 11 * pro[4] ? 0 : pro[0] - 11*pro[4]; if(t > 0) pro[0] = pro[0] <= t ? 0 : pro[0] - t; pro[2] = pro[2]%4; switch(pro[2]) { case 0: count += (4*pro[1]+pro[1]+35) / 36; break; case 1: if(pro[1] > 5) { pro[1] -= 5; pro[0] = pro[0] <= 7 ? 0 : pro[0]-7; count += (4*pro[1]+pro[0]+35) / 36; } else{ if(pro[0] > 27 - 4*pro[1]){ pro[0] = pro[0] - (27 - 4*pro[1]); count += (pro[0]+35) / 36; } } break; case 2: if(pro[1] > 3){ pro[1] -= 3; pro[0] = pro[0] <= 6 ? 0 : pro[0] - 6; count += (4*pro[1]+pro[0]+35) / 36; } else { if(pro[0] > 18 - 4*pro[1]){ pro[0] = pro[0] - (18 - 4*pro[1]); count += (pro[0]+35) / 36; } } break; case 3: if(pro[1] > 1) { pro[1] -= 1; pro[0] = pro[0] <= 5 ? 0 : pro[0] - 5; count += (4*pro[1]+pro[0]+35) / 36; } else { if(pro[0] > 9 - 4*pro[1]){ pro[0] = pro[0] - (9 - 4*pro[1]); count += (pro[0]+35) / 36; } } break; default : break; } printf("%d\n", count); } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator