Guest User

Untitled

a guest
Feb 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. class Solution {
  2. public:
  3. bool reachingPoints(int sx, int sy, int tx, int ty) {
  4. while (tx > 0 && ty > 0)
  5. {
  6. if (tx < sx || ty < sy)return false;
  7. if (tx == sx && ty == sy)return true;
  8. if (ty >= tx)ty -= tx;
  9. else if (tx > ty) tx -= ty;
  10. }
  11. return false;
  12. }
  13. };
Add Comment
Please, Sign In to add comment