Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int N, M;
- cin >> N >> M;
- int X, Y;
- cin >> X >> Y;
- if (N > M)
- {
- int a = N;
- N = M;
- M = a;
- }
- if (N - X < X && N - X < Y && N - X < M - Y)
- {
- cout << N - X;
- }
- if (X < N - X && X < Y && X < M - Y)
- {
- cout << X;
- }
- if (Y < X && Y < N - X && Y < M - Y)
- {
- cout << Y;
- }
- if (M - Y < X && M - Y < Y && M - Y < N - X)
- {
- cout << M - Y;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment