ACM-ICPC 2010/2011 Programming Problem – High Score
It’s getting closer and closer to the ACM-ICPC Programming contest in UCC this year so now more then ever we need practice. If you’re not up to speed on what it’s all about check out Carl’s first post on another ACM problem. So let’s get straight to the problem. I will present the problem in as clear and simple manner as I can, as the actual problem sheet is a little off putting if you ask me. You can download the pdf for it here.
The problem is all about entering your name into a high score table using a joystick. Quite like old video games where you would be presented with an initial string of A’s which moving the Joystick right and left selected a different character. Moving up and down cycled though the alphabet. Both these movements wrap around. Eg: If you move left at “A” you get to “Z” and if you move right at the last character you get to the first. So if I want to input the string “JAN” how many moves will it take me to do this? (23 😀 ) Moving left, right, up, down is counted as a move. So your task is to develop an algorithm that will find the shortest amount of moves to achieve this. For more information and sample input download the ACM problem sheet.
Some words of inspiration and motivation. Anyone can solve these problems if they put their mind too it. I wouldn’t count myself as smart individual, but I worked at it and solved a programming problem from a prestigious contest. So, give it a go, even if you can’t solve it, the experience of thinking about the problem and an algothrim to solve is great exercise for your brain. Watch this place or follow me on twitter to keep up-to-date @C_McCann
WARNING: (Only works with WebKit atm)There are bugs and certain inputs will crash the script, just to warn you. A refined solution with bugs fixed will be posted in the coming days with source code and explaination. Follow @Flaxproject and @C_McCann for updates