CF628A.Tennis Tournament
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 名参赛者的网球锦标赛正在进行。参赛者采用奥林匹克赛制,即获胜者晋级,失败者淘汰。
锦标赛按如下方式进行(其中 m 表示当前轮次的参赛者人数):
- 设 k 为不超过 m 的最大 2 的幂,即 k=2⌊log2m⌋;
- 当前轮次中,k 名参赛者进行比赛,其中一半(即 k/2 名)晋级下一轮,其余 m−k 名参赛者直接晋级下一轮;
- 当仅剩一名参赛者时,锦标赛结束。
每场比赛中,每位参赛者需消耗 b 瓶水,裁判需消耗 1 瓶水。此外,每位参赛者在整个锦标赛中会获得 p 条毛巾。
求本次锦标赛所需的水瓶总数和毛巾总数。
注意:这是一场网球锦标赛,因此每场比赛均有两名参赛者对决(其中一人获胜,另一人失败)。
输入格式
The only line contains three integers n, b, p (1 ≤ n, b, p ≤ 500) — the number of participants and the parameters described in the problem statement.
唯一的一行包含三个整数 n、b、p(1≤n,b,p≤500)——即参赛者人数以及题目描述中所述的参数。
输出格式
Print two integers x and y — the number of bottles and towels need for the tournament.
输出两个整数 x 和 y —— 分别表示该锦标赛所需的瓶子数量和毛巾数量。
输入输出样例
输入#1
5 2 3
输出#1
20 15
输入#2
8 2 4
输出#2
35 32
说明/提示
In the first example will be three rounds:
- in the first round will be two matches and for each match 5 bottles of water are needed (two for each of the participants and one for the judge),
- in the second round will be only one match, so we need another 5 bottles of water,
- in the third round will also be only one match, so we need another 5 bottles of water.
So in total we need 20 bottles of water.
In the second example no participant will move on to some round directly.
在第一个例子中,将进行三轮比赛:
- 第一轮将进行两场比赛,每场比赛需要 5 瓶水(每位参赛者各 2 瓶,裁判 1 瓶);
- 第二轮仅进行一场比赛,因此还需要另外 5 瓶水;
- 第三轮也仅进行一场比赛,因此还需要另外 5 瓶水。
因此,总共需要 20 瓶水。
在第二个例子中,没有任何参赛者能直接晋级到某一轮。
输入解题思路,AI测评打分。不知道怎么写?