Editorial for COCI '06 Contest 3 #2 N-puzzle


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

For each letter we calculate where it's supposed to end up at. We then sum the distances from the initial positions of all letters to their final positions.

The row and column indices of a letter's final position can be found using integral division by 4 (both the quotient and remainder) from the ASCII value of the letter, or using a hand-computed table.


Comments

There are no comments at the moment.