Even | CPP program to find max ( X , Y ) / min ( X , Y ) after P turns ; Driver code ; 1 st test case ; 2 nd test case
#include <bits/stdc++.h> NEW_LINE using namespace std ; int findValue ( int X , int Y , int P ) { if ( P % 2 == 0 ) return ( max ( X , Y ) / min ( X , Y ) ) ; else return ( max ( 2 * X , Y ) / min ( 2 * X , Y ) ) ; } int main ( ) { int X = 1 , Y = 2 , P = 1 ; cout << findValue ( X , Y , P ) << endl ; X = 3 , Y = 7 , P = 2 ; cout << findValue ( X , Y , P ) << endl ; }