本帖最後由 神秘二代 於 2013-11-27 00:06 編輯
It just depends on how you enumerate neighbour states.
KoolFreeze 發表於 2013-11-26 01:48


as i said....not easy to guess since duplicate number

TOP

本帖最後由 神秘二代 於 2013-11-27 21:19 編輯
I've written an example program. It can handle arbitrary number of slots and duplicate numbers. I on ...
KoolFreeze 發表於 2013-11-27 16:31


Sorry, your algorithm cannot pass the following case
5
50204
34030
63310
35361
23111

5
30002
34050
63311
35364
23111

Your algorithm result is 32, but correct answer is 18......
and..... some of cases also cannot get the best solutions.....
So that what i said cannot cover all of cases......

but anyway, thanks for your help

TOP

本帖最後由 神秘二代 於 2013-11-27 21:56 編輯

i think the key point is, h will changed in every state, and due to duplicate number, h are not accurate
may need to use dynamic programming

TOP

本帖最後由 神秘二代 於 2013-11-29 09:10 編輯

delete.

TOP

anyone can help

TOP