Skip to content

Instantly share code, notes, and snippets.

@mhmoodlan
Created October 6, 2017 07:59
Show Gist options
  • Save mhmoodlan/2cb208e4d38e0a52f846af3189f354df to your computer and use it in GitHub Desktop.
Save mhmoodlan/2cb208e4d38e0a52f846af3189f354df to your computer and use it in GitHub Desktop.
#Implementation #Easy #Codeforces #Solved
//http://codeforces.com/contest/709/problem/A
#include <bits/stdc++.h>
#define ll long long
#define sz(v) ((int) ((v).size()))
#define clr(v, d) memset(v, d, sizeof(v))
#define lp(i, n) for(int i = 0; i < (int)(n); ++i)
#define rep(i, v) for(int i = 0; i < sz(v); ++i)
using namespace std;
int main() {
int n, b, d, x, sum=0, output = 0; cin>>n>>b>>d;
lp(i, n) {
cin>>x;
if(x <= b) {
sum+=x;
if(sum > d) {
sum = 0;
output++;
}
}
}
if(sum > d) output++;
cout << output << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment