#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 A1A_1 sticks of length 11, A2A_2 sticks of length 22, and A3A_3 sticks of length 33. 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 aa, bb, and cc must satisfy the triangle inequality: a+b>ca + b > c, b+c>ab + c > a, and c+a>bc + a > b.

Determine the maximum number of triangles that can be made.

Given TT 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, casei\text{case}_i denotes the ii-th test case.

Each test case is given in the following format:

A1 A2 A3A_1 \ A_2 \ A_3
  • 1T10,0001 \leq T \leq 10,000
  • 0Ai1080 \leq A_i \leq 10^8
  • All input values are integers.

输出格式

Output TT lines. On the ii-th line, output the answer for the ii-th test case.

4
3 1 2
4 1 1
0 0 0
31415926 535897 93238462
2
1
0
41730095