artemgf

Книжный червь

Mar 23rd, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1. #include <iostream>
  2. #include <conio.h>
  3. #include <math.h>
  4. #include <string>
  5. #include <algorithm>
  6. #include <set>
  7.  
  8. using namespace ::std;
  9.  
  10. int main()
  11. {
  12.     int n, k, l, m;
  13.  
  14.     cin >> n >> k >> l >> m;
  15.  
  16.     if (l != m)
  17.     {
  18.         cout << abs((m - l - 1) * n + (m - l - 1)*k * 2 + k * 2);
  19.     }
  20.     else
  21.         cout << n;
  22.  
  23.     _getch();
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment