Skip to content

Instantly share code, notes, and snippets.

@listopad
Created December 26, 2019 13:00
Show Gist options
  • Save listopad/ef56a7b198611b762adffa6b93518374 to your computer and use it in GitHub Desktop.
Save listopad/ef56a7b198611b762adffa6b93518374 to your computer and use it in GitHub Desktop.
Задача B
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