Description: The n monkeys at the zoo are numbered 1, 2... N, in turn, wait for the keeper to divide the peach by rule. animal
The peach rule of the park is that each monkey can get m peaches, but it must be queued for collection. The keeper takes out one at a time,
2,... In the basket, the k peach is taken by the monkey, who is the head of the team. When you take the number of peaches in the basket, then you start again
1 to begin. When the number of peaches in the basket and the number of peaches from the team's first monkey have been obtained, the team's first monkey can be taken out completely
The basket is peaches. The monkey, which has a total of less than m, continues to queue at the end of the queue. The number of peaches in the basket plus the team's first monkey
When the number of peaches that have been obtained by the children exceeds m, the first monkey in the team can only fill m, then leave the queue and the remaining peaches in the basket are left
The next monkey is for use. Each monkey was assigned to m peaches.
To Search:
- [Josephus] - Josephus with the problem are defined as
- [stacks] - In a train dispatching station, one trac
File list (Check if you may need any files):