Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- using namespace std;
- ostream & operator<<(ostream & out, vector<int> const & v)
- {
- for (int el: v)
- out<< el <<' ';
- return out;
- }
- int main()
- {
- long long int q,n, x, a10, a5, a2, a1, answer, l ,u ,t,N,K, i,summ,m,k,o;
- vector<int> a;
- summ=0;
- q=0;
- o=0;
- cin >> n >> k >> m;
- for (i=0;i<n;++i)
- {
- cin >> x;
- a.push_back(x);
- }
- for (i=0;i<n+1;++i)
- {
- // cout<<" "<<i<<endl;
- if(((i+q)!=(k+q+1)) & i+q<n & (int(i==0)*(n-(i+q)-1)+int(i!=0)*k+1)>=k)
- {
- summ+=a[i+q];
- }
- else
- {
- if(summ==m)
- {
- o=q+1;
- break;
- }
- i=-1;
- ++q;
- summ=0;
- }
- if (q==n) break;
- }
- cout<<o;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement