#include <bits/stdc++.h>
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
using namespace std;
typedef long long ll;
typedef vector<int>vc;
int main()
{
// READ;
int n,ary[10004];
ll temp,sum;
while(~sc(n)&&n!=0)
{
for(int i=0; i<n; i++) sc(ary[i]);
sum=0;
temp=0;
for(int i=0; i<n; i++)
{
temp+=ary[i];
sum=max(sum,temp);
if(temp<0) temp=0;
}
sum>0?printf("The maximum winning streak is %lld.\n",sum):printf("Losing streak.\n");
}
return 0;
}
#define sc(a) scanf("%d",&a)
#define scd(a,b) scanf("%d%d",&a,&b)
#define sct(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define READ freopen ("input.txt","r",stdin)
using namespace std;
typedef long long ll;
typedef vector<int>vc;
int main()
{
// READ;
int n,ary[10004];
ll temp,sum;
while(~sc(n)&&n!=0)
{
for(int i=0; i<n; i++) sc(ary[i]);
sum=0;
temp=0;
for(int i=0; i<n; i++)
{
temp+=ary[i];
sum=max(sum,temp);
if(temp<0) temp=0;
}
sum>0?printf("The maximum winning streak is %lld.\n",sum):printf("Losing streak.\n");
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন