Problem H
Bachet's Game
Input
The input consists of a number of lines (between $1$ and $100$, inclusive). Each line describes one game by a sequence of positive numbers. The first number is $n \leq 1\, 000\, 000$ the number of stones on the table; the second number is $m \leq 10$ giving the number of numbers that follow; the last $m$ numbers on the line specify how many stones can be removed from the table in a single move.
Output
For each line of input, output one line saying either Stan wins or Ollie wins assuming that both of them play perfectly.
Sample Input 1 | Sample Output 1 |
---|---|
20 3 1 3 8 21 3 1 3 8 22 3 1 3 8 23 3 1 3 8 1000000 10 1 23 38 11 7 5 4 8 3 13 999996 10 1 23 38 11 7 5 4 8 3 13 |
Stan wins Stan wins Ollie wins Stan wins Stan wins Ollie wins |