Problem #137

Towers of Hanoi
Public 07/10/14 10xp Programming 44.4%

There is a 30 disk layout as shown below (from bottom to top) - not necessarily reached by way of always making the optimal moves:
1| 21 13 8 5 3 2 1
2| 25 16 9 4
3| 30 29 28 27 26 24 23 22 20 19 18 17 15 14 12 11 10 7 6

Target is to move all the disks to the second peg. To reach that target, what would be the layout after 10^9 optimal moves and what would be total of the moves if we assign 12 for a move from first to second, 13 for a move from first to third, etc. (possible moves would be 12,13,21,23,31,32)?

Input format: 1st peg,2nd peg,3rd peg,total

Example: 10965,321,874,2191 for the following

First layout for a 10-disk configuration:
1| 10 9 8 5 4
2| 7 6 3
3| 2 1

The layout after 100 moves targeting to move all the disks to the 3rd peg:
1| 10 9 6 5
2| 3 2 1
3| 8 7 4

total=2191

[My timing: <25s]



You need to be a member to keep track of your progress.
Register


Time may end, but hope will last forever.

Other Challenge Sites

Contact

elasolova
[64][103][109][97][105][108][46][99][111][109]