#abc260c. C - Changing Jewels
C - Changing Jewels
Score : points
问题陈述
Takahashi 拥有一颗等级为 的红宝石。(他没有其他宝石。)
Takahashi 可以任意多次进行以下操作。
- 将一颗等级为 ( 至少为 )的红宝石转换为“一颗等级为 的红宝石和 颗等级为 的蓝宝石”。
- 将一颗等级为 ( 至少为 )的蓝宝石转换为“一颗等级为 的红宝石和 颗等级为 的蓝宝石”。
Takahashi 希望获得尽可能多的等级为 的蓝宝石。通过这些操作,他最多可以获得多少颗等级为 的蓝宝石?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi has a red jewel of level . (He has no other jewels.)
Takahashi can do the following operations any number of times.
- Convert a red jewel of level ( is at least ) into "a red jewel of level and blue jewels of level ".
- Convert a blue jewel of level ( is at least ) into "a red jewel of level and blue jewels of level ".
Takahashi wants as many blue jewels of level as possible. At most, how many blue jewels of level can he obtain by the operations?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 3 4
Sample Output 1
12
Takahashi can obtain blue jewels of level by the following conversions.
- First, he converts a red jewel of level into a red jewel of level and blue jewels of level .
- After this operation, Takahashi has red jewel of level and blue jewels of level .
- Next, he repeats the following conversion times: converting a blue jewel of level into a red jewel of level and blue jewels of level .
- After these operations, Takahashi has red jewels of level and blue jewels of level .
- He cannot perform a conversion anymore.
He cannot obtain more than blue jewels of level , so the answer is .
Sample Input 2
1 5 5
Sample Output 2
0
Takahashi may not be able to obtain a blue jewel of level .
Sample Input 3
10 5 5
Sample Output 3
3942349900
Note that the answer may not fit into a -bit integer type.
update @ 2024/3/10 11:01:19