CF950A.Left-handers, Right-handers and Ambidexters

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are at a water bowling training. There are ll people who play with their left hand, rr people, who play with their right hand, and aa ambidexters, who can play with left or right hand.

The coach decided to form a team of even number of players, exactly half of the players should play with their right hand, and exactly half of the players should play with their left hand. One player should use only on of his hands.

Ambidexters play as well with their right hand as with their left hand. In the team, an ambidexter can play with their left hand, or with their right hand.

Please find the maximum possible size of the team, where equal number of players use their left and right hands, respectively.

输入格式

The only line contains three integers ll , rr and aa ( 0<=l,r,a<=1000<=l,r,a<=100 ) — the number of left-handers, the number of right-handers and the number of ambidexters at the training.

输出格式

Print a single even integer — the maximum number of players in the team. It is possible that the team can only have zero number of players.

输入输出样例

  • 输入#1

    1 4 2
    

    输出#1

    6
    
  • 输入#2

    5 5 5
    

    输出#2

    14
    
  • 输入#3

    0 2 0
    

    输出#3

    0
    

说明/提示

In the first example you can form a team of 66 players. You should take the only left-hander and two ambidexters to play with left hand, and three right-handers to play with right hand. The only person left can't be taken into the team.

In the second example you can form a team of 1414 people. You have to take all five left-handers, all five right-handers, two ambidexters to play with left hand and two ambidexters to play with right hand.

首页