311256: CF1957A. Stickogon

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

A. Stickogontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given $n$ sticks of lengths $a_1, a_2, \ldots, a_n$. Find the maximum number of regular (equal-sided) polygons you can construct simultaneously, such that:

  • Each side of a polygon is formed by exactly one stick.
  • No stick is used in more than $1$ polygon.

Note: Sticks cannot be broken.

Input

The first line contains a single integer $t$ ($1 \leq t \leq 100$) — the number of test cases.

The first line of each test case contains a single integer $n$ ($1 \leq n \leq 100$) — the number of sticks available.

The second line of each test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 100$) — the stick lengths.

Output

For each test case, output a single integer on a new line — the maximum number of regular (equal-sided) polygons you can make simultaneously from the sticks available.

ExampleInput
4
1
1
2
1 1
6
2 2 3 3 3 3
9
4 2 2 2 2 4 2 4 4
Output
0
0
1
2
Note

In the first test case, we only have one stick, hence we can't form any polygon.

In the second test case, the two sticks aren't enough to form a polygon either.

In the third test case, we can use the $4$ sticks of length $3$ to create a square.

In the fourth test case, we can make a pentagon with side length $2$, and a square of side length $4$.

Output

题目大意:
给定n根长度分别为a_1, a_2, ..., a_n的木棍,求可以同时构建的最大正多边形数量,要求每个多边形的每条边都由恰好一根木棍构成,且每根木棍不能用于超过1个多边形。注意:木棍不能折断。

输入数据格式:
第一行包含一个整数t(1 ≤ t ≤ 100)——测试用例的数量。
每个测试用例的第一行包含一个整数n(1 ≤ n ≤ 100)——可用的木棍数量。
每个测试用例的第二行包含n个整数a_1, a_2, ..., a_n(1 ≤ a_i ≤ 100)——木棍的长度。

输出数据格式:
对于每个测试用例,输出一个整数,表示可以同时从可用木棍构建的最大正多边形数量。

示例:
输入:
4
1
1
2
1 1
6
2 2 3 3 3 3
9
4 2 2 2 2 4 2 4 4

输出:
0
0
1
2

注意:
在第一个测试用例中,我们只有一根木棍,因此无法形成任何多边形。
在第二个测试用例中,两根木棍也不足以形成一个多边形。
在第三个测试用例中,我们可以使用4根长度为3的木棍来形成一个正方形。
在第四个测试用例中,我们可以用边长为2的木棍做一个五边形,以及用边长为4的木棍做一个正方形。题目大意: 给定n根长度分别为a_1, a_2, ..., a_n的木棍,求可以同时构建的最大正多边形数量,要求每个多边形的每条边都由恰好一根木棍构成,且每根木棍不能用于超过1个多边形。注意:木棍不能折断。 输入数据格式: 第一行包含一个整数t(1 ≤ t ≤ 100)——测试用例的数量。 每个测试用例的第一行包含一个整数n(1 ≤ n ≤ 100)——可用的木棍数量。 每个测试用例的第二行包含n个整数a_1, a_2, ..., a_n(1 ≤ a_i ≤ 100)——木棍的长度。 输出数据格式: 对于每个测试用例,输出一个整数,表示可以同时从可用木棍构建的最大正多边形数量。 示例: 输入: 4 1 1 2 1 1 6 2 2 3 3 3 3 9 4 2 2 2 2 4 2 4 4 输出: 0 0 1 2 注意: 在第一个测试用例中,我们只有一根木棍,因此无法形成任何多边形。 在第二个测试用例中,两根木棍也不足以形成一个多边形。 在第三个测试用例中,我们可以使用4根长度为3的木棍来形成一个正方形。 在第四个测试用例中,我们可以用边长为2的木棍做一个五边形,以及用边长为4的木棍做一个正方形。

加入题单

上一题 下一题 算法标签: