Kangaroo Meeting Point
Two kangaroos jump along a number line at the same time, and you need to know whether they will ever land on the same spot. The first starts at x1 and jumps v1 units each time; the second starts at x2 and jumps v2 units each time. Return YES if their positions match after the same number of jumps, otherwise return NO.
Примеры
Ввод
0, 3, 4, 2Вывод
"YES"Ввод
0, 2, 5, 3Вывод
"NO"Ввод
21, 6, 47, 3Вывод
"NO"Нужно реализовать
def number_line_jumps(x1: int, v1: int, x2: int, v2: int) -> str:
Теги
math
Accedi per vedere la cronologia degli invii
AccediAccedi per usare l'AI Mentor
AccediVisible tests
1
Input
0, 3, 4, 2Expected
"YES"2
Input
0, 2, 5, 3Expected
"NO"3
Input
21, 6, 47, 3Expected
"NO"4
Input
0, 2, 0, 2Expected
"YES"5
Input
43, 2, 70, 2Expected
"NO"6
Input
0, 3, 4, 3Expected
"NO"Focus radio
Paused · SomaFM · Fluid