环形石头剪刀布AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)A rock-paper-scissors tournament was held with $a+b+c$ participants. Here, $a, b, c$ are non-negative integers with $3\leq a+b+c$.
有 $a+b+c$ 名参与者参加了一场石头剪刀布比赛。其中,$a, b, c$ 是满足 $3\leq a+b+c$ 的非负整数。AI (CI翻译)
In the tournament, all participants first stand in a circle. Then, each participant plays "Rock," "Scissors," or "Paper."
比赛开始时,所有参与者先围成一个圆圈。随后,每位参与者同时出“石头”“剪刀”或“布”。AI (CI翻译)
For each participant, if the hand they played beats both the hand of the participant to their left and the hand of the participant to their right, that participant becomes a winner. There is not necessarily exactly one winner; there may be zero, or two or more winners.
如果某位参与者出的手势能同时战胜其左边和右边参与者出的手势,那么这位参与者就成为一名获胜者。获胜者不一定恰好有一名:可能没有获胜者,也可能有两名或更多获胜者。AI (CI翻译)
More formally, a participant becomes a winner if one of the following holds:
更具体地说,满足以下任意一种情况的参与者会成为获胜者:AI (CI翻译)
- The participant played "Rock," and both the left neighbor and the right neighbor played "Scissors."
- The participant played "Scissors," and both the left neighbor and the right neighbor played "Paper."
- The participant played "Paper," and both the left neighbor and the right neighbor played "Rock."
- 该参与者出“石头”,且左右两位邻居都出“剪刀”。
- 该参与者出“剪刀”,且左右两位邻居都出“布”。
- 该参与者出“布”,且左右两位邻居都出“石头”。
The following is known about this tournament:
已知这场比赛中:AI (CI翻译)
$a$participants played "Rock."$b$participants played "Scissors."$c$participants played "Paper."
- 有
$a$名参与者出“石头”。 - 有
$b$名参与者出“剪刀”。 - 有
$c$名参与者出“布”。
Under this condition, find the maximum possible number of winners in the tournament.
在此条件下,求比赛中获胜者人数的最大可能值。AI (CI翻译)
$T$ test cases are given; solve each of them.
给定 $T$ 组测试用例,请分别求解。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$1\leq T\leq 5\times 10^5$$0\leq a, b, c\leq 10^9$$3\leq a+b+c$- All input values are integers.
$1\leq T\leq 5\times 10^5$$0\leq a, b, c\leq 10^9$$3\leq a+b+c$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入读入,格式如下:AI (CI翻译)
T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_T
T
\mathrm{case}_1
\mathrm{case}_2
\vdots
\mathrm{case}_TAI (CI翻译)
Each test case is given in the following format:
每组测试用例的格式如下:AI (CI翻译)
a b c
a b cAI (CI翻译)
Output
输出格式
AI (CI翻译)Output one line per test case.
每组测试用例输出一行。AI (CI翻译)
For each test case, output the maximum possible number of winners in the tournament.
对于每组测试用例,输出比赛中获胜者人数的最大可能值。AI (CI翻译)
样例
6
3 1 2
2 2 2
123 456 789
10 0 0
10 0 100
100 0 10
2
1
578
0
9
10
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。