Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什么还是错啊,我把所有的测试程序都用上了

Posted by Maybesky at 2006-03-06 17:52:54 on Problem 1017
谁能帮我看看,我问什么总是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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator