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