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

Re:水题不断WA 谁帮忙看下····

Posted by dushen12 at 2011-05-07 22:22:19 on Problem 2014
In Reply To:水题不断WA 谁帮忙看下···· Posted by:lb1988 at 2010-07-08 11:40:36
> #include<iostream>
> using namespace std;
> int main()
> {
> 	int maxl,l,d,tl,td,x,y;
> 	while(cin>>maxl)
> 	{
> 		if(maxl==0) break;
> 		tl=0;
> 		td=0;
> 		x=0;
> 		y=0;
> 		while(cin>>l>>d)
> 		{
> 			if(l==-1 && d==-1) break;
> 			if(tl+l<=maxl)
> 			{
> 				tl+=l;
> 				if(d>td) td=d;
> 				if(tl>x) x=tl; 
> 			}
> 			else
> 			{
> 				if(td>y) y+=td;
> 				tl=0;
> 				td=0;
> 				tl=l;
> 				td=d;
> 			}
> 		}
> 		if(tl>x) x=tl;
> 		y+=td;
> 		cout<<x<<" x "<<y<<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