Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- #define ll long long
- #define nl endl
- int main()
- {
- ll t;
- cin >> t;
- vector<ll> v(t);
- for (int i = 0; i < t; i++)
- {
- cin >> v[i];
- if (i != 0)
- v[i] += v[i - 1] ;
- }
- int ind=0, worms[v[t-1] + 1];
- for (int i = 1; i <= v[t-1]; i++)
- {
- if (i >v[ind])
- ind++;
- worms[i] = ind + 1;
- }
- ll n;
- cin >> n;
- while (n--)
- {
- ll q;
- cin >> q;
- cout<<worms[q]<<nl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement