Halloween Candies (halloween)

326 teams scored 27400 points on this task, for a maximum score of 100, an average score of 84 and a median score of 100.

Highlights

  1. Ariosto Spallanzani Sezz. Cl. e Sc., Reggio Nell'Emilia is the institute with the most points (940).
  2. Emilia-Romagna is the region with the most points (4415).

Statement

Marco prepared a big basket with M candies for the usual "trick-or-treat" that is going to take place in his district during Halloween. He placed this basket on his porch, in front of the door, so that kids can take candies without having to ring the doorbell. In this district, things are very regular and the N kids who live here are numbered from 0 to N-1. Some kids are completely selfless and will not take any candies (to leave more candies for other kids to enjoy) while some other kids are greedy and will take one or more candies whenever they approach a house. Marco knows that the kids will approach his house in order, from the 0-th kid to the (N-1)-th kid, and that they will repeatedly come back to his house (after visiting the other houses in the district) in the same order, until there are no candies left. Help Marco calculate which kid is going to take the last candy in the basket!