题库练习 Boats Competition
← 上一题 下一题 →

A13737 | Boats Competition

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

There are $n$ people who want to participate in a boat competition. The weight of the $i$ -th participant is $w_i$ . Only teams consisting of two people can participate in this competition. As an organizer, you think that it's fair to allow only teams with the same total weight.

So, if there are $k$ teams $(a_1, b_1)$ , $(a_2, b_2)$ , $\dots$ , $(a_k, b_k)$ , where $a_i$ is the weight of the first participant of the $i$ -th team and $b_i$ is the weight of the second participant of the $i$ -th team, then the condition $a_1 + b_1 = a_2 + b_2 = \dots = a_k + b_k = s$ , where $s$ is the total weight of each team, should be satisfied.

Your task is to choose such $s$ that the number of teams people can create is the maximum possible. Note that each participant can be in no more than one team.

You have to answer $t$ independent test cases.

输入格式

The first line of the input contains one integer $t$ ( $1 \le t \le 1000$ ) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains one integer $n$ ( $1 \le n \le 50$ ) — the number of participants. The second line of the test case contains $n$ integers $w_1, w_2, \dots, w_n$ ( $1 \le w_i \le n$ ), where $w_i$ is the weight of the $i$ -th participant.

输出格式

For each test case, print one integer $k$ : the maximum number of teams people can compose with the total weight $s$ , if you choose $s$ optimally.

输入输出样例

输入 #1
5
5
1 2 3 4 5
8
6 6 6 6 6 6 8 8
8
1 2 2 1 2 1 1 2
3
1 3 3
6
1 1 3 4 2 2
输出 #1
2
3
4
1
2
C++ 编辑器
输入
输出