Daily

Random

Practice set

Baltic Way 2010 · Problem 9

Combinatorics

There is a pile of 1000 matches. Two players each take turns and can take 1 to 5 matches. It is also allowed at most 10 times during the whole game to take 6 matches, for example 7 exceptional moves can be done by the first player and 3 moves by the second and then no more exceptional moves are allowed. Whoever takes the last match wins. Determine which player has a winning strategy.

Change pool

When you’re ready

Review material becomes available with the next Daily.

Review

Topics

Games and strategies · Algorithms and processes · Invariants and monovariants

Solutions

Solution

Let rr be the number of the remaining exceptional moves in the current position (at the beginning of the game r=10r=10 and rr decreases during the game). The winning strategy of the second player is the following. After his move the number of matches in the pile must have the form 6n+r6n + r, where n>rn > r, or 7n7n, where n≤rn \le r (observe that 6n+r=7n6n + r = 7n for n=rn = r).

At the beginning of the game the initial number of matches 1000=6⋅165+101000 = 6 \cdot 165 + 10 agrees with this strategy.

What happens during two consecutive moves?

Consider the case n>rn > r first. If the first player takes k=1,2,…,5k = 1, 2, \dots, 5 matches (and hence rr is not changing during his move) then the second player takes 6−k6 - k matches. So players take 66 matches together and the pile contains now 6(n−1)+r6(n-1) + r matches.

Contest context

Results from Baltic Way 2010

10 teams

Mean score
2.5 / 5
Scores of 4 or 5
5 / 10
Estonia
4 / 5

Score distribution

04
11
20
30
41
54
All team scores
TeamScore
Poland0 / 5
Lithuania5 / 5
Germany1 / 5
Latvia5 / 5
Denmark5 / 5
Sweden5 / 5
Estonia4 / 5
Norway0 / 5
Finland0 / 5
Iceland0 / 5