Accepted solution

709A - Juicer.

Open original problem
Source code

#include <iostream>

#include<vector>

#include<string>

#include<math.h>

/***** S. M. Sabiul Hajjaj Sabit *****/

using namespace std;

int main()

{

    int a,b,c;

    int total=0;

    int wst=0;

    cin>>a>>b>>c;

    for(int i=0; i<a; i++)

    {

        int t;

        cin>>t;

        if(t<=b)

        {

          wst+=t;

            if(wst>c)

            {

                total++;

                wst=0;

            }

        }

    }

    cout<<total<<endl;

}
Join the discussion

Add your comment