WeRideOA #5
Bot Movement Reachability (Two Move Types)
Estimated MediumJudge-ready
Topics (AI-labelled)Bits & Math
A robot starts at positive integer coordinates (x1,y1) and can perform (x,y)→(x+y,y) or (x,y)→(x,x+y) any number of times. Determine whether it can reach (x2,y2).
The ranges of the start and end points and the two moves are precisely defined; this site specifies stdin/stdout.
Input
One line with four integers x1 y1 x2 y2 (each in 1..1000).
Output
Output Yes if reachable, otherwise output No.
Example 1
Input:
1 1 3 2
Output:
Yes
Example 2
Input:
1 1 2 2
Output:
No
Example 3
Input:
2 3 7 3
Output:
No
Editorial
Loading solution…