logo AlgoBeat OnlineJudge
登录 注册

#216643. [GKS 2017 #E] Trapezoid Counting

内存限制:1024 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In this problem, we will consider a trapezoid to be a convex quadrilateral with exactly one pair of parallel sides. If the lengths of the two non-parallel sides are equal, we say the trapezoid is isosceles.

You have some wooden sticks of various lengths, and you need to pick exactly four of them to form the four sides of an isosceles trapezoid. How many different sets of four sticks will allow this? Even if two sticks have the same length, they are considered to be different sticks. Sticks could not be bent and broke into parts.

输入格式

The first line of the input gives the number of test cases, . test cases follow; each consists of two lines. The first line consists of one integer , the number of sticks. The second line consists of integers; the -th of these, , represents the length of the -th stick.

输出格式

For each test case, output one line containing Case #x: y, where is the test case number (starting from ), and is the number of different sets of four sticks that can form an isosceles trapezoid, as described above.

样例

样例输入 1

4
5
2 3 3 4 3
4
1 5 3 1
4
2 2 3 3
9
3 4 1 4 2 5 3 1 3

样例输出 1

Case #1: 5
Case #2: 0
Case #3: 0
Case #4: 73

数据范围与提示

In Sample Case #1, there are five ways to choose four out of the five given sticks, and any one of those five sets of four sticks can be used to form an isosceles trapezoid.

In Sample Case #2, note that the set , , , cannot form an isosceles trapezoid, even though two of its sticks are of equal length.

In Sample Case #3, note that the set , , , can form a rectangle, but in this problem, a rectangle is not considered to be an isosceles trapezoid.

Limits

.

.

Small dataset (Test set 1 - Visible)

.

Large dataset (Test set 2 - Hidden)

.