Can someone tell me how to solve this problem with the correct algorithm? I saw many people solve this problem,
but i have no idea with it. Please help me orz...
4408
Moderator: Board moderators
4408
electron
Re: 4408
Hi! Could you explain it clearly? I has a bottleneck in how to check the halting condition...because such as the third test case
5234 -> 1212, should i check 5234 -> 11212 -> 21212 -> 31212 -> ... ?
By the way, Thank for your reply ![:D](./images/smilies/icon_biggrin.gif)
5234 -> 1212, should i check 5234 -> 11212 -> 21212 -> 31212 -> ... ?
![:cry:](./images/smilies/icon_cry.gif)
![:D](./images/smilies/icon_biggrin.gif)
electron
Re: 4408
Well, the statements say
When I meet the already visited state during the search, I stopped the search..
Hope this help..![:-)](./images/smilies/icon_smile.gif)
So, all possible states are 0000~9999.. I simply did mod 10000 every time moving into other state..The lock always uses least significant 4 digits after addition
When I meet the already visited state during the search, I stopped the search..
Hope this help..
![:-)](./images/smilies/icon_smile.gif)
Re: 4408
Oh!! I think i make a big mistake... i transform the problem to the coin change one and solve it by DP...
But due to the cyclic property, i can't always find the best solution
...
I was too fool to make this mistake orz... and thank you very much!!!
By the way, your blog is very usefull and a perfect site ![:)](./images/smilies/icon_smile.gif)
Thank you again !!![:P](./images/smilies/icon_razz.gif)
But due to the cyclic property, i can't always find the best solution
![:(](./images/smilies/icon_frown.gif)
I was too fool to make this mistake orz... and thank you very much!!!
![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
Thank you again !!
![:P](./images/smilies/icon_razz.gif)
electron
Re: 4408
You mean Felix Halim's site..? It's not mine.. it's Felix Halim's ![:-)](./images/smilies/icon_smile.gif)
He also built the great tool for TopCoder if you are interested..
http://felix-halim.net/tc
![:-)](./images/smilies/icon_smile.gif)
He also built the great tool for TopCoder if you are interested..
http://felix-halim.net/tc