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<iostream> using namespace std; int main() { int a1,a2,a3,a4,a5,a6; int total; int rest; while(1) { cin>>a1>>a2>>a3>>a4>>a5>>a6; if ((a1+a2+a3+a4+a5+a6) == 0) break; total = a6+a5+a4+a3/4; a1 -= a5*11; rest = 5*a4 - a2; if (rest>=0) {a1 = a1 - rest*4;a2 = 0;} if (rest<0) a2 = -rest; if ((a3%4) == 3) { if (a2>0) {a2--; a1 -= 5;} else a1 -= 9; total++; } else if ((a3%4) == 2) { if (a2>=3) {a2 -= 3;a1 -= 6;} else if(a2>0) {a1 = a1+a2*4-18; a2 = 0;} else a1 -= 18; total++; } else if ((a3%4) == 1) { if (a2>=5) {a2 -= 5;a1 -=7;} else if(a2>0) {a1 = a1+a2*4-27; a2 = 0;} else a1 -= 27; total++; } if (a2%18 == 0) total += a2/18; else { total += a2/18; total++; a1 = a1 + (a2%18)*4 -36; } if (a1>0) { if (a1%36 == 0) total += a1/36; else total += a1/36 + 1; } cout<<total<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator