Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- // put your code here
- int N, M, X, Y, a, b;
- cin >> N >> M >> X >> Y;
- if (M > N) {
- N = M + N;
- M = N - M;
- N = N - M;
- }
- if (X < Y) {
- a = X;
- }
- else {
- a = Y;
- }
- if (M - X < N - Y) {
- b = M - X;
- }
- else {
- b = N - Y;
- }
- if (a < b) {
- cout << a;
- }
- else {
- cout << b;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement