Source Code
#include<bits/stdc++.h>
#define all(s) s.begin(), s.end()
#define sz(s) (int) s.size()
using namespace std;
void DeathRoad(){
    int n;
    long long x, t; cin >> n >>  x >> t;
    vector<int> v(n + 5);
    long long total = 0, preSum = 0;
    for(int i = 1; i <= n; i++){
        cin >> v[i];
        total += v[i];
    }
    long long res = t % total;
    int ans = 0;
    for(int i = 1; i <= n + 1; i++){
        if((res - preSum) >= 1 && (res - preSum) <= x)
            ans++;
        preSum += v[i];
    }
    cout << ans;
}
int main() {
    ios_base::sync_with_stdio(0);
    
    int T = 1;
    //cin >> T;
    while (T--)
        DeathRoad();
    return 0;
}
/***
        We're here for death, so let's go to it together!
***/
 
Copy
Treasure MhmudAbdGhafar
GNU G++17
0 ms
596 KB
Wrong Answer