fork download
  1. // Online C++ compiler to run C++ program online
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. // Write C++ code here
  8. long long n, b, d, count=0, wasted = 0;
  9. cin >> n >> b >> d;
  10.  
  11. for(int i=0; i<n; i ++){
  12. long long a;
  13. cin >> a;
  14. if(a < b){
  15. count += a;
  16. }
  17. if(count > d){
  18. wasted ++;
  19. count -= a;
  20. }
  21. }
  22.  
  23. cout << wasted;
  24. return 0;
  25. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
Standard output is empty