Timer is Running

Given a number **X** and another number **Y **. There are a total **N** cycles , and alternatively we perform operation on each number . In each cycle , we multiply the number by 2 . Starting with **X** .

Suppose after all the **N** cycles, the number **X** has become **W** and number **Y** has become **Z **. You have to calculate the division of the maximum number among **W **and **Z** by the minimum number among **W** and** Z **.

**Input:**

The first line of the input contains an integer **T** denoting the number of test cases. The description of each testcase follows. Each test case contains a single line with 3 integers **X **, **Y **, and **N **.

**Output:**

For each test case output a new line with a single integer which should be the answer.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ X ≤ 10^{7}

1 ≤ Y ≤ 10^{7}

1 ≤ N ≤ 10^{7}

**Example:
Input:**

2

1 2 1

3 2 3

1

3

In the first testcase ( only one cycle ), the initial numbers are (

In the second testcase, the initial numbers are **(X = 3, Y = 2) **. There three turns. In the first cycle X is multiplied by 2 . So, we get ( **X** = 6, **Y** = 2 ) . In the second cycle **Y ( Y = 2)** multiplies his number by 2. Hence, we get ( **X** = 6, ** Y** = 4 ) . In the third cycle **X ( X = 6) **is multiplied by 2. So, we get (**X** = 12, **Y** = 4) . As **N** = 3 , and we are completed with 3 cyles , therefore **W** = 12, and **Z** = 4 .

max ( **W **, **Z **) / min ( **W **, **Z **) = 12 / 4 = 3. Hence the second output is 3.

Author: diksha1812

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

abnandi04 | 801 |

KshamaGupta | 412 |

srivastavad270 | 223 |

bhavyapratap56 | 206 |

anshusingh20112001 | 181 |

abnandi04 | 776 |

KshamaGupta | 296 |

srivastavad270 | 223 |

bhavyapratap56 | 206 |

afreensartaj131 | 170 |

blackshadows | 5362 |

Ibrahim Nash | 5244 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4748 |

Login to report an issue on this page.