Source Code
#include <bits/stdc++.h>
#define endl "\n"
#define debug(a) cout << #a << ": " << a << endl
#define debugLine() cout << "==============" << endl
#define tick() cout << "Tick" << endl
#define testCases() int t; cin >> t; while(t--)
#define all(a) a.begin(), a.end()
#define fillWith(a, b) memset(a, b, sizeof(a))
#define Mod 1000000007
#define goFast() ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define files(x) freopen(x, "r", stdin)
typedef long long ll;
typedef long double ld;
using namespace std;

#define int long long

main()
{
    goFast();
    int N, meD, depth;
    cin >> N >> meD >> depth;
    int theyD[N + 3];
    int sum = 0;
    for(int i = 0; i < N; i++)
    {
        cin >> theyD[i];
        sum += theyD[i];
    }
    sum += meD;
    int sum2 = 0;
    int counter = 0;
    for(int i = 0; i <= N; i++)
    {
        if(((depth % sum) - sum2) < meD && ((depth % sum) - sum2) >= 0)
            counter++;
        if(i != N)
            sum2 += theyD[i];
    }
    cout << counter << endl;
}
Copy
Treasure AhmadShahal
GNU G++17
0 ms
596 KB
Wrong Answer