hi,

can anybody plzz look at this problem. i tried a recursive greedy approach
but it was too slow i guess


 You have a truck that you need to completely fill up with merchandise. You
have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4,
8x8x8, 16x16x16, ..., 2k x 2k x 2k for all k ≥ 0. (Infinite supply of
merchandise of each dimension too!)

You wish to fill the truck of dimension AxBxC completely using only these
merchandise. Given A, B & C, what is the smallest number of merchandise you
will need to fill the truck completely?

The first line of the input will contain a number T (1 ≤ T ≤ 1000)
containing the number of test cases. Each line that follows is a separate
test case which has exactly 3 space separated integers A B C (1 ≤ A, B, C <
106) which denotes the dimensions of the truck. Additionally, min(A,B,C) <
1000.

For each case, output a single line containing the minimum number of items
needed to fill the entire truck.
*Sample Input:*

5
1 1 1
1 2 3
3 4 5
4 5 6
123 12345 123456

*Sample Output:*

1
6
32
29
1951997538

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to