Pashanze

Untitled

Nov 25th, 2021 (edited)
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int N, M;
  8. cin >> N >> M;
  9.  
  10. int X, Y;
  11. cin >> X >> Y;
  12.  
  13. if (N > M)
  14. {
  15. int a = N;
  16. N = M;
  17. M = a;
  18. }
  19. if (N - X < X && N - X < Y && N - X < M - Y)
  20. {
  21. cout << N - X;
  22. }
  23. if (X < N - X && X < Y && X < M - Y)
  24. {
  25. cout << X;
  26. }
  27. if (Y < X && Y < N - X && Y < M - Y)
  28. {
  29. cout << Y;
  30. }
  31. if (M - Y < X && M - Y < Y && M - Y < N - X)
  32. {
  33. cout << M - Y;
  34. }
  35.  
  36. return 0;
  37. }
Add Comment
Please, Sign In to add comment