-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsolution.h
More file actions
32 lines (30 loc) · 847 Bytes
/
solution.h
File metadata and controls
32 lines (30 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
Code generated by https://github.com/goodstudyqaq/leetcode-local-tester
*/
#if __has_include("../utils/cpp/help.hpp")
#include "../utils/cpp/help.hpp"
#elif __has_include("../../utils/cpp/help.hpp")
#include "../../utils/cpp/help.hpp"
#else
#define debug(...) 42
#endif
class Solution {
public:
bool reachingPoints(int sx, int sy, int tx, int ty) {
while (true) {
if (tx == ty) {
if (sx == tx && sy == ty) return true;
return false;
}
if (tx < sx || ty < sy) return false;
if (tx > ty) {
if (sy == ty && (tx - sx) % ty == 0) return true;
tx %= ty;
} else {
if (sx == tx && (ty - sy) % tx == 0) return true;
ty %= tx;
}
}
return false;
}
};