Advertisement
Pashanze

Untitled

Nov 25th, 2021
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4.   // put your code here
  5.     int N, M, X, Y, a, b;
  6.     cin >> N >> M >> X >> Y;
  7.     if (M > N) {
  8.         N = M + N;
  9.         M = N - M;
  10.         N = N - M;
  11.        
  12.     }
  13.     if (X < Y) {
  14.         a = X;
  15.     }
  16.     else {
  17.         a = Y;
  18.     }
  19.     if (M - X < N - Y) {
  20.         b = M - X;
  21.     }
  22.     else {
  23.         b = N - Y;
  24.     }
  25.     if (a < b) {
  26.         cout << a;
  27.     }
  28.     else {
  29.         cout << b;
  30.     }
  31.    
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement