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

大神帮忙看一下,为什么是WA

Posted by funfanfuns at 2015-03-12 23:53:17 on Problem 2586
#include<iostream>
using namespace std;
int mouth[12],tot;
int main()
{
    int s,d,i,j,j1;
    while(cin>>s>>d)
    {
        for(i=0;i<12;i++)
            mouth[i]=s;
        for(i=0;i<8;i++)
        {
            tot=0;
            for(j=0;j<5;j++)
              {
                  tot+=mouth[i+j];
              }
              j1=j;
            while(tot>0)
                  {
                      tot=tot-s-d;
                      mouth[i+j1]=-d;
                      j1--;
                  }
        }
        tot=0;
        for(i=0;i<12;i++)
            tot+=mouth[i];
       if(tot>0)
            cout<<tot<<endl;
       else cout<<"Deficit"<<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