Source Code
#include<bits/stdc++.h>
#include <stdio.h>
#include <algorithm>

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define LL long long
#define LD long double
#define pb push_back
#define F first
#define S second


const double PI=3.1415926535897932384626433;
const int KL=1e6;
const LL MOD=1e9+7;


using namespace std;
/*
typedef complex<double> point;
#define x real()
#define y imag()
*/

LL q,x,y,z,n,m,a[KL],mn=1e9,mx=-1e9,ans;
string t;
vector <LL> vec;
set <LL> s;
map <LL,LL> mp;


int main()
{
    scl(n);scl(x);scl(m);
    LL tot=0;
    for(int i=1;i<=n;i++)scl(a[i]),tot+=a[i];
    tot+=x;
    LL sum=0;
    for(int i=0;i<=n;i++){
        sum+=a[i];
        LL nm=m/tot;
        LL nwm=m-nm*tot;
        if(nwm==0 && i==n){
            ans++;
            continue;
        }
        if(sum<nwm && sum+x>=nwm)ans++;
    }
    printf("%lld\n",ans);

    return 0;
}
Copy
Treasure Vectors_Master
GNU G++17
18 ms
2.4 MB
Accepted