Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Why is it that moving from one point to another involve GCD ?

Правка en1, от SASANQUA, 2020-07-17 09:23:06

I was reading a solution for a problem which states that:

Given $$$(x_0, y_0)$$$ as the starting point, is it possible to move from it to another point $$$(x_1, y_1)$$$ ? In one move at a point $$$(x, y)$$$, you can move to four possible positions: $$$(x+y, y), (x-y, y), (x, y+x), (x, y-x)$$$. ($$$-10^9\leq x_0,x_1,y_0,y_1\leq10^9)$$$

The solution says that it is possible to move from $$$(x_0, y_0)$$$ to $$$(x_1, y_1)$$$ iff $$$GCD(x_0, y_0) = GCD(x_1, y_1)$$$. Other than that, there are no other explanations why it is like that. Can anyone explain? Thanks!

Теги gcd, 2d

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский SASANQUA 2020-07-17 09:23:06 598 Initial revision (published)