Source Code
#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n))
typedef bitset<10> MASK;

void fast() {
    cin.tie(0);
    cin.sync_with_stdio(0);
}

int main() {
    fast();
    ll n, x, t;
    cin >> n >> x >> t;
    ll cur = 0, ans = 0, total = x;
    ll arr[n];
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        total += arr[i];
    }
    for (int i = 0; i <= n ; ++i) {
        ll rem = t - (cur + x);
//        cout<<rem<<" "<<total<<endl;
        if(rem<=0){
            ans++;
            break;
        }
        else{
               if((total - (rem%total))%total<=x) ans++;
        }
        if(i==n)break;
        cur += arr[i];
    }
    cout << ans;
}
Copy
Treasure 7eem
GNU G++17
0 ms
512 KB
Wrong Answer