SP6299 MOVMRBL - Move Marbles

Description

You have N marbles and K slots. You have to follow the below mentioned rules : 1. You can put in a marble or take out a marble from slot numbered 1 at any time. 2. You can put in a marble or take out a marble from slot numbered i only if there exists a marble at the slot i - 1. 3. The game stops when a marble reaches the slot numbered K for the first time. Your task is to finish the game in minimum number of valid moves. ### Input The first line contains t, the number of testcases. Then on each line is given two numbers N

Input Format

N/A

Output Format

N/A