Advertisement
STANAANDREY

Discurs (7)

Dec 28th, 2021
1,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. signed main() {
  5.     int n, m, c;
  6.     cin >> n >> m >> c;
  7.     int sum = 0, ans = n;
  8.     for (int x, i = 1; i <= n; i++) {
  9.         cin >> x;
  10.         if (sum + x <= m * c) {
  11.             sum += x;
  12.         } else {
  13.             ans = i;
  14.             break;
  15.         }
  16.     }
  17.  
  18.     cout << ans << endl;
  19.     return 0;
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement