Source Code
#include <cstring>
#include <vector>
#include <stdio.h>
#include <bitset>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include<sstream>
#include <iomanip>
#include<utility>
#include <iostream>
#define ll long long
//int a[3];
using namespace std;
int main()
{

	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n, x,y, t;cin >> n>>x>>t;
	vector < ll > v; ll sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> y;
		v.push_back(y);
		sum += y;
	}
		ll e = (t / sum * sum);
		if (sum == t) {
			e = 0;
		}
		ll ctr=1;
		for (int i = 0; i < n; i++) {
			if (e + x >= t&&e+v[i]<t) {
				ctr++;
			}
			e += v[i];
		}
		cout << ctr;
}
Copy
Treasure makamkh899
GNU G++17
2 ms
256 KB
Wrong Answer