## 10444 - Multi-peg Towers of Hanoi

Moderator: Board moderators

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

### 10444 - Multi-peg Towers of Hanoi

Hello,
I have tried to solve the problem in all the ways but got wa in 0:004s.
What may be the problem??
My method is first to choose the bound (lower and upper) of n1, where n1 is the disks taken from n disks to intermidiate pegs. and then solve the problem by D and C method(Divide and Con.).
Please discuss abt the common errors for this prticular problem. I used POS system.(Optimal and Greedy).
My question is:
When I got the inequility, what should i do??
I have taken the least value of n1 from the inequility.
Should I choose the mean value of the ineuility or should i choose the upper bound??
I saw it has no special judge problem.
So what abt the cases when I have several n1 to choose, can it give different value for each n1??
Thabk for help.
If you can't understand, I will put my src here..
"Everything should be made simple, but not always simpler"

Dmytro Chernysh
Experienced poster
Posts: 146
Joined: Sat Apr 26, 2003 2:51 am
Do you need input/output? I can give you...
Mail me...

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:
ok. i have solved it by dp.
but i face problem to print all the moves.
plz help.
--
anupam
"Everything should be made simple, but not always simpler"

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

ok now but tle.
plz help
"Everything should be made simple, but not always simpler"

Dmytro Chernysh
Experienced poster
Posts: 146
Joined: Sat Apr 26, 2003 2:51 am
Solve the problem only once!!! At the begining save the answer in a table [200,20].

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

Do you mean precalculation??
"Everything should be made simple, but not always simpler"

anupam
A great helper
Posts: 405
Joined: Wed Aug 28, 2002 6:45 pm
Contact:

thank you. got ac by precalculation
"Everything should be made simple, but not always simpler"

ulin
New poster
Posts: 15
Joined: Wed Jun 30, 2004 11:24 am
Location: POLAND (Plock)

### 10444 - Multi-peg Tower of Hanoi - WA

Hi!
I use dp and I have no idea, why it get WA. (where it could be mistake in my program)
Maybe some tricky inputs?

Best Regards!

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
have you considered n = 0?
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

ulin
New poster
Posts: 15
Joined: Wed Jun 30, 2004 11:24 am
Location: POLAND (Plock)
Yes!
For n=0 I print 0

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
I don't think there is tricky input other than n = 0, just some simple in/out here:

in:

Code: Select all

``````0 4
0 20
1 4
1 20
100 10
100 20
200 4
200 20
0 0
``````
out:

Code: Select all

``````Case 1: 0
Case 2: 0
Case 3: 1
Case 4: 1
Case 5: 601
Case 6: 361
Case 7: 14680065
Case 8: 801
``````
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

iluvmylife
New poster
Posts: 1
Joined: Thu Aug 18, 2005 8:34 pm

### hi

hi ppl!!!

can neone send me the source code (preferably C) for the multipeg tower of hanoi prob, plzzzzzzzzzzz...

plz send it to undercover_sherlock@yahoo.com

plz...
thnx