mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
<p>Given four integers <code>sx</code>, <code>sy</code>, <code>tx</code>, and <code>ty</code>, return <code>true</code><em> if it is possible to convert the point </em><code>(sx, sy)</code><em> to the point </em><code>(tx, ty)</code> <em>through some operations</em><em>, or </em><code>false</code><em> otherwise</em>.</p>
|
|
|
|
<p>The allowed operation on some point <code>(x, y)</code> is to convert it to either <code>(x, x + y)</code> or <code>(x + y, y)</code>.</p>
|
|
|
|
<p> </p>
|
|
<p><strong>Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> sx = 1, sy = 1, tx = 3, ty = 5
|
|
<strong>Output:</strong> true
|
|
<strong>Explanation:</strong>
|
|
One series of moves that transforms the starting point to the target is:
|
|
(1, 1) -> (1, 2)
|
|
(1, 2) -> (3, 2)
|
|
(3, 2) -> (3, 5)
|
|
</pre>
|
|
|
|
<p><strong>Example 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> sx = 1, sy = 1, tx = 2, ty = 2
|
|
<strong>Output:</strong> false
|
|
</pre>
|
|
|
|
<p><strong>Example 3:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> sx = 1, sy = 1, tx = 1, ty = 1
|
|
<strong>Output:</strong> true
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= sx, sy, tx, ty <= 10<sup>9</sup></code></li>
|
|
</ul>
|