Codeforces AIM Tech Round 3 (Div. 2) A.Juicer

#include<bits/stdc++.h>

using namespace std;

#define fast ios_base::sync_with_stdio(false)

typedef long long LL;

int main()
{
    fast;
    LL n, b, d;

    while(cin >> n >> b >> d)
    {
        LL cnt=0 , x , sum=0 ;

        while(n--)
        {
            cin >> x;

            if(x <= b) sum+=x;

            if(sum > d) cnt++, sum=0;
        }

        cout << cnt << "\n";
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number