Description
A tennis tournament with n participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out.
The tournament takes place in the following way (below, m is the number of the participants of the current round):
let k be the maximal power of the number 2 such that k ≤ m,
k participants compete in the current round and a half of them passes to the next round, the other m - k participants pass to the next round directly,
when only one participant remains, the tournament finishes.
Each match requires b bottles of water for each participant and one bottle for the judge. Besides p towels are given to each participant for the whole tournament.
Find the number of bottles and towels needed for the tournament.
Note that it’s a tennis tournament so in each match two participants compete (one of them will win and the other will lose).

这篇博客介绍了如何计算一场有n名参赛者的网球锦标赛所需的水和毛巾数量。比赛按照奥林匹克系统进行,每轮比赛最多有k(2的幂)位选手,其中一半晋级,另一半直接进入下一轮。每场比赛需要每位选手b瓶水和一位裁判一瓶水,每位选手在整个比赛期间还需要p条毛巾。博客提供了样例输入和输出,并解释了如何得出答案。
最低0.47元/天 解锁文章
487

被折叠的 条评论
为什么被折叠?



