TRUCKL - Truckloads

no tags 

We have a pile of crates at our warehouse that we want to load onto trucks. Our plan is to divide the pile in half forming two smaller piles, then continuing dividing each of the small piles in half until we get piles that will fit on a truck. (Of course, when we divide an odd number of crates in "half", one of the resulting piles will have one more crate than the other.) Our problem is to determine how many trucks we will need to ship the crates.

Input

Each case contain two integers , numCrates (the number of crates at the warehouse) and loadSize (the maximum number of crates that will fit in a truck), 0<numCrates<=2^31 , 0<loadSize<=2^31 ,Input will terminate by EOF .

Output

For each case print one line contain an integer represent the number of trucks required.

Example

Input:
14 3
15 1
1024 5
Output:
6
15
256

hide comments
Ahmed Atito: 2014-09-11 17:48:31

Weak Test Cases .. pure recursion passed !!


Added by:Mohamed Ali
Date:2013-04-27
Time limit:0.191s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All