PROJECT EULER · #0973
Random Dealings
A game is played with
Each round proceeds as follows:
- Select a pile at random and pick it up.
- Randomly choose a pile from the table and add the top card of the picked-up pile to it.
- Redistribute any remaining cards from the picked-up pile by dealing them into new single-card piles.
The game ends when all cards are in a single pile.
At the end of each round a score is obtained by bitwise-XORing the size of each pile. The score is summed across the rounds. Let
You are given
Find
Write-up coming later
The complete problem is available here. An approach, code, and answer will be added later.