Source Code
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define s second
#define f first
#define pb push_back
int n,x,t,sum;
int a[200005];
int vis[200005];
signed main()
{
    cin>>n>>x>>t;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        sum+=a[i];
    }
    a[0]=0;
    int base=t/(sum+x);
    if(t%(sum+x)==0)
    {
        puts("1");
        return 0;
    }
    int cur=0;
    int ans=0;
    for(int i=0;i<=n;i++)
    {
        cur+=a[i];
        if(base*(sum+x)+cur<t&&base*(sum+x)+cur+x>=t) ans++;
    }
    cout<<ans<<endl;
    return 0;
}
Copy
Treasure ahmedfouadnew
GNU G++17
56 ms
2.3 MB
Accepted