Editorial for ECOO '13 R1 P1 - Take a Number


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.

This is a fairly straightforward simulation. Here is one way to do it:

For each "day" of the simulation, get the first number (number of late students) by counting the occurrences of the word TAKE, the second (number left in line at end of day) by subtracting the number of occurrences of SERVE, and the third (next number in machine) by keeping track of the next number, adding 1 after each TAKE event, and resetting it to 1 if it goes over 999.


Comments

There are no comments at the moment.