問題一覧 > 通常問題

No.1057 Nice Days

レベル : / AI推定難易度 : 124 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 520
作問者 : Enjapma_kyopro / テスター : Mister
お気に入りにしたユーザー ProblemId : 4263 / 自分の提出
問題文最終更新日: 2020-05-19 01:25:21
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 249 (順位表) の他の問題:

Problem Statement

In the refrigerator, there are $A$ shortcakes and $B$ chocolate cakes.
Seeing them, Enjapma decided to eat $1$ cake per $1$ day for $A+B$ days starting today.

Now, counting today as day $1$, if day $i$ $( 2 \le i \le A+B)$ satisfies the following condition, day $i$ is called a "nice day".

Condition: The type of cake eaten on the previous day differs from the type of cake eaten on that day.

If Enjapma chooses the order of eating the cakes cleverly, what is the maximum possible number of nice days?

Input

$A\ B$

  • All inputs are integers.
  • $1 \le A \le 7$
  • $1 \le B \le 7$

Output

Output the maximum number of "nice days".
Print a newline at the end.

Sample

Sample 1
Input
4 3
Output
6

By eating shortcakes and chocolate cakes alternately starting from day $1$, every day from day $2$ onward can be made a "nice day".

Sample 2
Input
3 1
Output
2

By eating a chocolate cake on day $2$ and shortcakes on the other days, day $2$ and day $3$ can be made "nice days".

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