問題一覧 > 通常問題

No.2175 Exciting Combo

レベル : / AI推定難易度 : 112 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 251
作問者 : MasKoaTS / テスター : 👑 箱星 👑 potato167
お気に入りにしたユーザー ProblemId : 8387 / 自分の提出
問題文最終更新日: 2024-11-28 20:28:31
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 372 (順位表) の他の問題:

Problem Statement

Core is hooked on a fighting game.

In this game, you can use $3$ types of moves numbered $1,2,3$.
Using move $i$ $(1 \leq i \leq 3)$ $1$ time deals $A_{i}$ damage to the enemy. Here, $A_{1} \leq A_{2} \leq A_{3}$.

Also, using these moves $1$ time each in the order $1 \to 2 \to 3$ triggers a combo,
which deals an additional $B$ damage to the enemy on top of the damage from the $3$ moves.

When you perform the operation "freely choose $1$ of moves $1,2,3$ and use it $1$ time" $3$ times,
find the maximum damage that can be dealt to the enemy.

Constraints

  • $1 \leq A_{1} \leq A_{2} \leq A_{3} \leq 100$

  • $1 \leq B \leq 100$

  • All inputs are integers.

Input

The input is given in the following format.

$A_{1}$ $A_{2}$ $A_{3}$ $B$
  • The $1$st line contains $A_{1}, A_{2}, A_{3}, B$ in this order, separated by single spaces.

Output

Output the answer on $1$ line.

Sample

Sample 1
Input
1 2 3 4
Output
10

It is best to use moves $1 \to 2 \to 3$ in this order, $1$ time each.

In this case, move $1$ deals $1$ damage, move $2$ deals $2$ damage, and move $3$ deals $3$ damage to the enemy,
and the combo being triggered deals an additional $4$ damage.

Therefore, a total of $1+2+3+4=10$ damage is dealt to the enemy.

It is not possible to deal more damage than this to the enemy.

Sample 2
Input
3 9 9 3
Output
27

For example, you can use move $2$ $3$ times in a row. In this case, $9 \times 3 = 27$ damage is dealt to the enemy.

If you use moves $1, 2, 3$ in this order, $1$ time each, move $1$ deals $3$ damage, move $2$ deals $9$ damage, move $3$ deals $9$ damage, and the combo deals $3$ damage to the enemy, but
the total of these is $24$ damage, which is less than $27$ damage.

Sample 3
Input
77 77 77 77
Output
308

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。