問題一覧 > 通常問題

No.920 Red and Blue

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 499
作問者 : polylogK / テスター : lumc_
お気に入りにしたユーザー ProblemId : 3395 / 自分の提出
問題文最終更新日: 2019-11-08 19:59:09
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 230 (順位表) の他の問題:

If you are experiencing an issue where mathematical formulas are not displayed, please take the following steps.

https://twitter.com/yukicoder/status/1191757446596812800?s=20

Problem Statement

Initially, there are $X$ red balls, $Y$ blue balls, and $Z$ white balls.
Yukari can perform the following operations any number of times.

  • Replace $1$ white ball with $1$ red ball.
  • Replace $1$ white ball with $1$ blue ball.
  • Make $1$ purple ball from $1$ red ball and $1$ blue ball.
Find the maximum number of purple balls Yukari can make.

Input

$X\ Y\ Z$
  • $0 \le X, Y, Z \le 20$
  • All inputs are integers.

Output

Output the maximum number as an integer on one line.

Sample

Sample 1
Input
3 4 5
Output
6

By changing the $5$ white balls into $3$ red balls and $2$ blue balls, you can make $6$ purple balls.

Sample 2
Input
1 5 8
Output
7

Sample 3
Input
1 5 9
Output
7

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