Consider a game with k piles of coins. Two players alternate turns. In each turn
ID: 3550531 • Letter: C
Question
Consider a game with k piles of coins. Two players alternate turns. In each turn, they must remove some non-zero number of coins from one of the piles. The player who takes the last coin loses.
An initial configuration is a sequence of values (P_1, P_2, ..., P_k) which represents that pile i has P_i coins in it. We call such a configuration winning if the first player to act can force a win (i.e., force the other player to eventually take the last coin).
Write a polynomial-time algorithm that, given an initial configuration (P_1, P_2, ..., P_k), decides if it is a winning configuration.
Explanation / Answer
Let n1, n2,
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.