SHARE
TWEET

Untitled

a guest Oct 30th, 2018 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     #include <iostream>
  2.     using namespace std;
  3.     int main() {
  4.         int N, M, i, j;
  5.         cin >> N >> M;
  6.         int snow[10000] = {};
  7.         for (i = 0; i <= N; i++) {
  8.             snow[i] = 0;
  9.         }
  10.         for (i = 0; i < M; i++) {
  11.             int comm, a, b, c;
  12.             cin >> comm;
  13.             if (comm == 1) {
  14.                 cin >> a >> b >> c;
  15.                 for (j = a; j < b; j++) {
  16.                     snow[j] = snow[j] + c;
  17.                 }
  18.             }
  19.             if (comm == 2) {
  20.                 cin >> a >> b;
  21.                 int summ=0;
  22.                 for (j = a; j < b; j++) {
  23.                     summ = summ + snow[j];
  24.                 }
  25.                 cout << summ << endl;
  26.             }
  27.         }
  28.         return 0;
  29.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top