Tuesday, August 30, 2016

Codeforces-(dev 709A)-A. Juicer

#include<stdio.h>
#include<math.h>
int main()
{
    int i,n,b,c = 0,d,sum = 0,a[100001];
    scanf("%d %d %d",&n,&b,&d);
 
    for(i = 0 ; i < n ; i++)
    {
        scanf("%d",&a[i]);
        if(a[i] <= b){
        sum += a[i];}
        if(sum>d){c++;sum = 0;}
    }
    printf("%d\n",c);
 
    return 0;
}

No comments: