ccbeginner

THFSHOJ 555

Oct 21st, 2020 (edited)
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define int long long
  4. #define SZ(X) (int)(X).size()
  5.  
  6. int32_t main(){
  7.     int n,m;
  8.     cin >> n;
  9.     int sum = 0;
  10.     for(int i = 0; i < n; ++i){
  11.         int x;
  12.         cin >> x;
  13.         sum += x;
  14.     }
  15.     cin >> m;
  16.     for(int i = 0; i < m; ++i){
  17.         int a,b,c;
  18.         cin >> a >> b >> c;
  19.         sum += (b-a+1) * c;
  20.         cout << sum << '\n';
  21.     }
  22.     return 0;
  23. }
Add Comment
Please, Sign In to add comment