Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- #include <cmath>
- using namespace std;
- int main()
- {
- long long n, q, k[100001], ki, j, i, prom=0;
- cin >> n;
- k[0] = 0;
- for (int o = 1; o <= n; o++)
- {
- cin >> ki;
- prom += ki;
- k[o] = prom;
- }
- cin >> q;
- for (int o = 1; o <= q; o++)
- {
- cin >> i >> j;
- cout << k[j] - k[i - 1] << endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment