About Me

About Me : I have been working as a Software Engineer for various international companies for four years.Currently, I am working as a full stack Javascript developer in Petronas(Malaysia).

Skills

Skills • Javascript •Typescript •Python •C •Java •ReactJs • Redux • VueJs • NestJs • React Testing Library • Django• PostgreSQL • MySQL • NodeJs • Git • Docker • Jira • Visual Studio Code • Slack

মঙ্গলবার, ৪ আগস্ট, ২০১৫

UVA Solution :10684-The Jackpot

#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;
}

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন