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
5234 -> 1212, should i check 5234 -> 11212 -> 21212 -> 31212 -> ... ? By the way, Thank for your reply
electron
Re: 4408
Well, the statements say
When I meet the already visited state during the search, I stopped the search..
Hope this help..
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..
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
Thank you again !!
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
Thank you again !!
electron
Re: 4408
You mean Felix Halim's site..? It's not mine.. it's Felix Halim's
He also built the great tool for TopCoder if you are interested..
http://felix-halim.net/tc
He also built the great tool for TopCoder if you are interested..
http://felix-halim.net/tc