Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int N, M, i, j;
- cin >> N >> M;
- int snow[10000] = {};
- for (i = 0; i <= N; i++) {
- snow[i] = 0;
- }
- for (i = 0; i < M; i++) {
- int comm, a, b, c;
- cin >> comm;
- if (comm == 1) {
- cin >> a >> b >> c;
- for (j = a; j < b; j++) {
- snow[j] = snow[j] + c;
- }
- }
- if (comm == 2) {
- cin >> a >> b;
- int summ=0;
- for (j = a; j < b; j++) {
- summ = summ + snow[j];
- }
- cout << summ << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement