#P15735. [JAG 2024 Summer Camp #2] Give Me a Lot of Triangles
[JAG 2024 Summer Camp #2] Give Me a Lot of Triangles
题目描述
You have sticks of length , sticks of length , and sticks of length . You can perform the following operation any number of times:
- Choose 3 sticks such that they can form a triangle. Use these 3 sticks to make a triangle. Once used, these sticks cannot be used to form other triangles.
To "form a triangle", the lengths of the chosen sticks , , and must satisfy the triangle inequality: , , and .
Determine the maximum number of triangles that can be made.
Given test cases, compute the answer for each.
输入格式
The input is given in the following format:
$$\begin{aligned} &T \\ &\text{case}_1 \\ &\text{case}_2 \\ &\vdots \\ &\text{case}_T \end{aligned} $$Here, denotes the -th test case.
Each test case is given in the following format:
- All input values are integers.
输出格式
Output lines. On the -th line, output the answer for the -th test case.
4
3 1 2
4 1 1
0 0 0
31415926 535897 93238462
2
1
0
41730095