Created
December 26, 2019 13:00
-
-
Save listopad/ef56a7b198611b762adffa6b93518374 to your computer and use it in GitHub Desktop.
Задача B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static void GetMinimumDistanceToPoolEdge(int N, int M, int x, int y) { | |
// находим длинный бортик | |
if (N > M) { | |
int tmp = N; | |
N = M; | |
M = tmp; | |
} | |
if (x >= N / 2) { | |
x = N - x; | |
} | |
if (y >= M / 2) { | |
y = M - y; | |
} | |
if (x < y) | |
System.out.println(x); | |
else | |
System.out.println(y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment