Submit | All submissions | Best solutions | Back to list |
TRUCKL - Truckloads |
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
Added by: | Mohamed Ali |
Date: | 2013-04-27 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |