No.1057 Nice Days
タグ : / 解いたユーザー数 520
作問者 :
Enjapma_kyopro
/ テスター :
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もしくは右上の雲マークをクリックしてアカウントを作成してください。