CF950A.Left-handers, Right-handers and Ambidexters
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are at a water bowling training. There are l people who play with their left hand, r people, who play with their right hand, and a 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.
你正在参加一场水保龄球训练。有 l 个人用左手打球,r 个人用右手打球,还有 a 个左右手皆宜者(ambidexters),他们既可以用左手也可以用右手打球。
教练决定组建一支人数为偶数的队伍,其中恰好一半队员用右手打球,另一半队员用左手打球。每位队员只能使用自己的一只手参赛。
左右手皆宜者既可以用左手打球,也可以用右手打球。在队伍中,一个左右手皆宜者可以选择用左手或右手参赛。
请找出满足“用左手和用右手的队员人数相等”这一条件的最大可能的队伍规模。
输入格式
The only line contains three integers l, r and a (0 ≤ l, r, a ≤ 100) — the number of left-handers, the number of right-handers and the number of ambidexters at the training.
唯一的一行包含三个整数 l、r 和 a(0 ≤ l, r, a ≤ 100)—— 分别表示训练中左撇子、右撇子和双手同利者的人数。
输出格式
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 6 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 14 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.
在第一个例子中,你可以组成一支由 6 名队员构成的队伍。你需要选取唯一的左撇子选手,以及两名双手同利者(用左手参赛),再选取三名右撇子选手(用右手参赛)。剩下唯一一人无法入选该队伍。
在第二个例子中,你可以组成一支由 14 人构成的队伍。你需要选取全部 5 名左撇子选手、全部 5 名右撇子选手,以及两名双手同利者(用左手参赛)和另外两名双手同利者(用右手参赛)。
输入解题思路,AI测评打分。不知道怎么写?