Source Code
/*
 * Aur0Ra
 */
#include <bits/stdc++.h>
#include <string>
#define ll long long
#define sf scanf
#define pf printf
#define to(ww,u,v) for(int ww=u;ww<=v;ww++)
#define tor(ww,u,v) for(int ww=u;ww>=v;ww--)
#define B break
#define C continue
#define P push_back
#define Pb pop_back
#define E "\n"
#define F first
#define S second
//%[^\n]%*c
using namespace std;
void file()
{
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
}
const unsigned int inf=4294967295,inf1=1e9+7,inf2=1e9+9;
const int N=2e5+10,M=5010,mod=1e9+7;
int tc,n,x,a[N],ans;
ll t,sum;
int main()
{
//    file();
    sf("%d%d%lld",&n,&x,&t);
    to(i,1,n)
    {
        sf("%d",&a[i]);
        sum+=a[i];
    }
    sum+=x;
    t=t%sum;
    to(i,1,n)
    {
        if(x>=t)
        {
            ans=i;
            B;
        }
        t-=a[i];
    }
    pf("%d\n",ans?ans:1);
}
Copy
Treasure Aurora
GNU G++17
0 ms
732 KB
Wrong Answer