Closest Cat Wins

On a number line, two cats run toward the same mouse at the same speed. The function cats_and_a_mouse receives the position of Cat A as x, Cat B as y, and the mouse as z. Compare the distances to the mouse: return Cat A if the first cat is closer, Cat B if the second cat is closer, or Mouse C if the distances are equal.

Примеры

Ввод
1, 2, 3
Вывод
"Cat B"
Ввод
1, 3, 2
Вывод
"Mouse C"
Ввод
2, 5, 3
Вывод
"Cat A"

Нужно реализовать

def cats_and_a_mouse(x: int, y: int, z: int) -> str:

Теги

math
PostgreSQLv16

Tukaj bo rezultat izvajanja kode

Visible tests
1
Input
1, 2, 3
Expected"Cat B"
2
Input
1, 3, 2
Expected"Mouse C"
3
Input
2, 5, 3
Expected"Cat A"
4
Input
5, 5, 5
Expected"Mouse C"
5
Input
10, 20, 15
Expected"Mouse C"
6
Input
-5, 5, 5
Expected"Cat B"
Focus radio
Paused · SomaFM · Fluid