#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll n;
while(cin >> n && n > 0)
{
int a[n], i;
for(i=0;i<n;i++)
{
cin >> a[i];
}
ll finals = INT_MIN, total = 0;
for(i=0;i<n;i++)
{
total = total + a[i];
if(finals < total)
finals = total;
if(total < 0)
total = 0;
}
if(finals > 0)
{
cout << "The maximum winning streak is " << finals << "." << endl;
}
else
cout << "Losing streak." << endl;
}
return 0;
}
Comments
Post a Comment