Two players A and B are playing a variant of Nim.
At the beginning, there are several piles of stones. Each pile is either at the side of A or at the side of B. The piles are unordered.
They make moves in turn. At a player's turn, the player can
either choose a pile on the opponent's side and remove one stone from that pile;
or choose a pile on their own side and remove the whole pile.
The winner is the player who removes the last stone.
Let
For example
Nr. | Piles at the side of A | Piles at the side of B |
---|---|---|
1 | none | |
2 | none | |
3 | none | |
4 | none | |
5 | ||
6 | ||
7 | ||
8 | none | |
9 | none |
Find
A、B 两位玩家正在玩一个变种尼姆游戏。游戏开始时,他们面前有若干堆无序的石子,每堆石子要么在靠 A 的一侧、要么在靠 B 的一侧。
他们轮流进行操作。轮到某玩家操作时,他可以
要么,在靠对手一侧的石子中,移除一颗石子。
要么,在靠自己这侧的石子中,移除 一堆 石子。
移除最后一颗石子的人获胜。
记
序号 | 在 A 这侧的石子堆 | 在 B 这侧的石子堆 |
---|---|---|
1 | 无 | |
2 | 无 | |
3 | 无 | |
4 | 无 | |
5 | ||
6 | ||
7 | ||
8 | 无 | |
9 | 无 |
求
点 这个链接 回到源站。
点 这个链接 回到详细版题目目录。