| Problem 151 - Power Crisis, Explanations |
It's always the same simulation problem, with subtle variations.
If you are within the Time Limit, you can submit a table.
You are looking for the smallest number m.
Problem 130 - Roman Roulette is really similar.
Problem 133 - The Dole Queue is really similar.
If you are in trouble with the multi-entry input, read my how to read input.
The problem is that it is clearly fairest to turn off Wellington last (after all, that is where the Electricity headquarters are), so for a given N, the `random' number m needs to be carefully chosen so that region 13 is the last region selected.
Write a program that will read in the number of regions and then determine the smallest number m that will ensure that Wellington (region 13) can function while the rest of the country is blacked out.
Input will consist of a
series of lines, each line containing the number of regions (N) with
. The file will be terminated by a line consisting of
a single 0.
Output will consist of a series of lines, one for each line of the input. Each line will consist of the number m according to the above scheme.
17 0
7