IPSC Logo

Internet Problem Solving Contest

IPSC 2005

Solution to Problem R – Rotate And Cut

The problem could easily be solved by simulating the procedure Thomas has used. For the easy input this would work fine enough. In the hard input, we have to make sure to stop the simulation after less than four letters on the slip remain. We can do this, because any subsequent simulation will leave the slip in the same state (as the count of letters to cut rounds down to zero).