QOJ.ac

QOJ

時間限制: 1.0 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#9690. 钢铁战士

统计

你正在玩一款卡牌游戏。初始时,你的抽牌堆为空,手牌中有 4 张牌:Rage(愤怒)、Shrug It Off(耸肩)、Pommel Strike(拳击)和 Body Slam(全身撞击)。每次你从手牌中打出一张牌,在结算其效果后,你需要将其放入抽牌堆。各卡牌的效果如下:

Rage:技能牌;消耗 0 点能量。在你打出一张攻击牌后,获得 5 点护甲(该效果可叠加,意味着如果你已经打出过两次 Rage,则每次打出攻击牌后你将获得 10 点护甲)。

Shrug It Off:技能牌;消耗 1 点能量。获得 11 点护甲并抽一张牌。

Pommel Strike:攻击牌;消耗 1 点能量。造成 10 点伤害并抽两张牌。

Body Slam:攻击牌;消耗 0 点能量。造成等同于当前护甲值的伤害(先造成伤害,再结算 Rage 带来的护甲提升)。

每次抽牌时,如果抽牌数量大于或等于抽牌堆的大小,你将把抽牌堆中所有的牌抽入手中;否则,你从抽牌堆中随机抽取指定数量的牌放入手中。问题是:如果你初始拥有 $n$ 点能量,你能保证造成的最大伤害是多少(无论牌是如何被抽取的)?

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^{18}$)。

输出格式

输出一行,包含一个整数:能造成的最大伤害。

样例

输入 1

1

输出 1

20

输入 2

3

输出 2

72

输入 3

4

输出 3

105

说明

在第一个测试用例中,你可以按以下顺序打出卡牌:

  1. 打出 Rage。抽牌堆:Rage;手牌:Shrug It Off, Pommel Strike, Body Slam。
  2. 打出 Body Slam,造成 0 点伤害,并获得 5 点护甲(因为 Rage 的效果)。抽牌堆:Rage, Body Slam;手牌:Shrug It Off, Pommel Strike。
  3. 打出 Pommel Strike,消耗 1 点能量,从抽牌堆中抽到 Rage 和 Body Slam,造成 10 点伤害,并获得 5 点护甲(因为 Rage 的效果)。抽牌堆:Pommel Strike。手牌:Rage, Shrug It Off, Body Slam。
  4. 打出 Body Slam,造成 10 点伤害,并获得 5 点护甲(因为 Rage 的效果)。抽牌堆:Pommel Strike, Body Slam。手牌:Rage, Shrug It Off。

在第二个测试用例中,你可以打出:Rage, Body Slam, Pommel Strike, Shrug It Off, Body Slam, Pommel Strike, Body Slam。

在第三个测试用例中,你可以打出:Rage, Shrug It Off, Body Slam, Pommel Strike, Shrug It Off, Body Slam, Pommel Strike, Body Slam。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.