HANOI07 - Building the Tower
There are N cubes in a toy box which has 1-unit height, the width is double the height. The teacher organizes a tower-building game. The tower is built by the cubes. The height of the tower is H (h levels). The bottom of the tower contains M cubes; and for all above level, each must contains a number of cubes which is exactly 1 less than or greater than the number of cubes of the level right below it. Your task is to determine how many different towers can be there. Two towers are considered different if there is at least one number i (1< i <=H) so that the i'th level of one tower contains a different number of cubes to the i'th level of the other tower.
The first line of input file is the integer number t ( 0 < t < 1002 ) , the number of test cases . Each test case in one line , the line contains three positive number N, H and M (N <= 32767, H<=60, M<=10).
With each test case , write in one line , the total of different towers that can be founded.
Input: 2 7 3 2 22 5 4 Output: 2 10 (* In the first test case , all the towers are : 2-1-2 , 2-3-2 . *)
the toy box height/width has nothing to do with solving the problem
CAN 2200*H*H*M PASS THIS PROBLEM?
つ ◕_◕ ༽つ GIFF AC:
do the toy box height/width have anything to do with solving the problem?Last edit: 2011-10-19 16:32:30
Really Nice Problem! :D
nice problem :)
Tony Beta Lambda:
64-bit integers are necessary.
:) Read the problem statement CAREFULLY.