← 返回 google 的题目列表Babylon Game Simulation
类型:online_judge
Game Background
Number of Players: 2, alternating turns
Tiles: 12 pieces
4 colors (Y / W / G / B)
3 pieces of each color
Initial State:
12 independent stacks with height 1
The tile color is on top of each stack
Move Rules
A legal move is:
Move an entire stack onto another stack (merge two stacks)
It must satisfy one of the following conditions:
Both stacks have the same height
The top color of both stacks is the same
After merging:
The resulting stack height = the sum of the heights of the two stacks
New top color = the top color of the stack placed on top
Win Conditions
The last player able to make a move wins
If it's your turn and there is no legal merge move possible → You lose
Example
Input
Y
W
G
B
Y
W
G
B
Y
W
G
B