Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define SZ(X) (int)(X).size()
- int32_t main(){
- int n,m;
- cin >> n;
- int sum = 0;
- for(int i = 0; i < n; ++i){
- int x;
- cin >> x;
- sum += x;
- }
- cin >> m;
- for(int i = 0; i < m; ++i){
- int a,b,c;
- cin >> a >> b >> c;
- sum += (b-a+1) * c;
- cout << sum << '\n';
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment