Jeep Plus

Time Limit : 1 Second

Memory Limit : 128 MB

Submission: 19

Solved: 10

    Our jeep is in the desert and we have a hard task: First we must reach a point which is N kilometers away from our camp, and then return to our camp. The terrain is tough, the car is old, and it seems like the fuel flows out, and because of this on every kilometer travelled, one litre of fuel is spent. But the jeep only has fuel tank with total capacity of M < N litres. On other hand, there is unlimited amount of fuel at our camp, and there are empty fuel tanks everywhere in the desert, these fuel tanks are large enough. When the jeep is passing near these fuel tanks, it can leave unlimited amount of fuel to them, or take unlimited amount of fuel from them to the jeep’s fuel tank.

     Write a program which calculates the minimum amount of fuel in litres which is needed to reach the destination point and return to home.
    The input consists of multiple test cases.

    The first line contains a number T, the number of the cases.

    In the next T lines, every line contains two integers N and M. It is known that 5*M >= N > 0.(N <= 32000).

      For each test, write a single line contains the result (the minimum litres of fuel, eventually rounded up), must be written on the only line of output.

sample input
3000 1000
32000 6400
sample output
Sheng NI
© 2015 HUST ACMICPC TEAM. All Right Reserved.