Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define MAXN 100001
- long long a[MAXN], sum;
- int n, test;
- int x, k, m;
- int main (){
- cin >> test;
- while (test--){
- while (cin >> x){
- if (x == 0){
- cin >> n;
- for (int i = 1; i <= n; i++){
- cin >> a[i];
- }
- }else if (x == 1){
- cin >> k >> m;
- a[k] += m;
- }else if (x == 2){
- sum = 0;
- cin >> k >> m;
- for(int i = k; i <= m; i++ ){
- sum += a[i];
- }
- cout << sum << endl;
- } else if (x == 3)
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment