Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- const int N = 1e5 + 6, mod = 998244353, inf = 1e9, pp = 31, lg = 15;
- int main()
- {
- int n, m, x;
- cin >> n;
- vector<int>a(n);
- for (int i = 0; i < n; i++)
- cin >> a[i];
- for (int i = 1; i < n; i++)
- a[i] += a[i - 1];
- cin >> m;
- while (m--)
- {
- cin >> x;
- cout << lower_bound(a.begin(), a.end(), x) - a.begin() + 1 << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement