Skip to content

# 138. Candy Sharing #32

@yuanweilin

Description

@yuanweilin

In a kindergarten, there are n children sitting in a circle facing their teacher
in the center. Each child initially has an even number of candy pieces.
When the teacher blows a whistle, each child simultaneously gives half of
his or her candy pieces to the neighbor on the left. Any child who ends up
with an odd number of pieces is given another piece by the teacher. Then
the teacher blows her whistle again, unless all the children have the same
number of candies, in which case the game stops. Can this game go on
forever or will it eventually stop to let the children go on with their lives?

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions