Question
Please answer in c++ and please explain the program in steps. Thank you You are given a pair of integers (x,y). You may perform either
Please answer in c++ and please explain the program in steps. Thank you
You are given a pair of integers (x,y). You may perform either of the two operations below,in any order, zero or more times.
1. (x,y) -> (x+y,y) 2. (x,y) -> (x,y+x)
For example, you can start with (1, 4), change it to (5, 4), change that to (5, 9), and then change that again to (5, 14). You are given four integers: a, b, c, and d. Return Yes (without quotes) if it is possible to start with the pair (a, b) and end with the pair (c, d). Otherwise, return No.
Method signature: string function(int a, int b, int c, int d)
Input Four integers in separate lines.
Output One string Yes or No.
Constraints
1 a,b,c,d 1000
Sample Input 1 4 5 9
Sample Output Yes
Explanation (1, 4) -> (5, 4) -> (5, 9) .
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started