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 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator