CF950A Left-handers, Right-handers and Ambidexters

    • 109通过
    • 171提交
  • 题目来源 CodeForces 950A
  • 评测方式 RemoteJudge
  • 标签
  • 难度 普及-
  • 时空限制 1000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    【题目描述】

    你现在在一个运动队里。

    这个队里有l 个人只能用他的左手训练(左撇子),另外有r 个人只能用右手训练(右撇子),还有a 个两只手都可以训练的人(既不是左撇子也不是右撇子,但只能用一只手)。

    你们的教练决定组建一支队伍,但要保证队伍里用左手训练的人和用右手训练的人一样多。 你的任务是找到这个团队里最多能有多少个人。

    【输入格式】

    输入的是3个整数l,r,a(0<=l,r,a<=100),代表左撇子,右撇子和既不是左撇子也不是右撇子的人数。

    【输出格式】

    输出一个整数,代表这个队伍里最多有多少人,如果组不成这样的队伍,则输出0 .

    Translated by @cn:苏卿念

    题目描述

    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.

    输入输出格式

    输入格式:

    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.

    输出格式:

    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.

    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。