// 2019 IUSB Programming Competition // Round 1 Problem 6 // Can you reach a destination point from a source point // Solution by Liguo Yu #include using namespace std; bool isReachable(int sx, int sy, int dx, int dy); int main() { int x1, y1, x2, y2; cin >> x1; cin >> y1; cin >> x2; cin >> y2; bool yes = isReachable(x1, y1, x2, y2); if ( yes == true) cout << "yes"; else cout << "no"; return 0; } bool isReachable(int sx, int sy, int dx, int dy) { if (sx > dx || sy > dy) return false; else if (sx == dx && sy == dy) return true; else return (isReachable(sx + sy, sy, dx, dy) || isReachable(sx, sy + sx, dx, dy)); }