Timer is Running

Geek and Coffee Shop
Submissions: 7593   Accuracy:


  Difficulty: Basic   Marks: 1

Geek love's to drink cold coffee after coding for long hour's. One fine day Geek went to his favourite coffee shop in the town and asked for a cup of cold coffee. The shopkeeper told him that he is their lucky customer and had an offer for the Geek. The offer was that for an amount of N they will fill Geek's cup with N units of cold coffee, the offer doesn't over yet. After consuming initial N units of coffee the shopkeeper will again refill his cup with half the amount of coffee that Geek consumed in previous refill, and will keep on refilling his cup till the amount to refill becomes nil i.e. 0 (Assume Geek can consume infinite amount of coffee and shop also has infinite amount coffee). Now Geek is curious to know that how many units of coffee will Geek get for Mth refill. Being Geek's friend help him out with his problem.    

The first line of the input contains an integer T, denoting the number of test cases. The T test case follow. The only line of each test case contains two space separated integers N and M respectively.

For each test case output a single integer on a new line denoting the required answer.



100 4
10 3


TestCase 1:
For the 4th refill geek will get 12 units of the coffee.
1st Fill: Geek will get 100 units of Coffee
2nd Fill: 100/2 = 50 units

3rd Fill: 50/2 = 25 units
4th Fill: 25/2 = 12 units

** For More Input/Output Examples Use 'Expected Output' option **

Author: harshitsidhwa

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.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.