Khachaturyan M.

Robin Hood captured seven rich men and demanded a ransom. A servant of each rich man brought a purse with gold, and they all lined up in front of the tent to pay the ransom. Each servant entering the tent placed the purse they brought on the table in the center of the tent, and if such a purse or a heavier one had not been brought before, the rich man was released along with the servant. Otherwise, the servant was told to bring another purse that would be heavier than all the purses currently on the table. After fetching another purse, the servant went to the end of the line. The time it took for each servant to fetch a purse was the same, so the order of entering the tent did not change.

When Robin Hood released all the captives, there were: a) 28; b) 27 purses on the table. What was the initial position in the line of the servant of the rich man who was released last?
If a servant brings a new purse, and since the last time he was in the tent, no one has been released, then he is definitely in for luck (his purse is the heaviest and this time his master will be released). That is, if there were $\mathrm{N}$ rich people in captivity and only one was just released, then there can be no more than $N-1$ failures in a row after that.

a) If there were seven rich people at the start, the first one will be released immediately, then there will be no more than 6 failures, followed by a success and no more than 5 failures, and so on - in total, Robin Hood will receive no more than $(1+6)+(1+5)+(1+4)+(1+3)+(1+2)+(1+1)+1=28$ purses. And he will get exactly 28 purses only if on the first round, everyone except the first one had a failure, then everyone except the second one, and so on. The seventh servant will put down the last purse.

b) If Robin Hood ended up with 27 purses instead of 28, then exactly one interval of failures must be one shorter than the maximum. Then it will end not after the transition to the next round, but one step earlier, and on this round, in addition to the servant with the lowest number, the seventh servant will also be lucky.

If this happened on the last round, when all the other servants had already left, then the seventh servant will put down the last purse. But if some servants are still left when the seventh servant has a stroke of luck out of turn, then the remaining ones will continue to leave in order, as in the previous point. And the last purse will be put down by the last of the remaining - the sixth servant.

## Answer

a) Seventh; b) sixth or seventh.