CF1598C Delete Two Elements
题目描述
有一个有 $n$ 个元素的数组 $a$ 。令 $k$ 为所有元素算术平均数。
求删掉其中两个元素后剩下元素算术平均数仍为 $k$ 的方案数。(注:先删掉第 $i$ 个,再删掉第 $j$ 个元素和先删掉第 $j$ 个元素,再删掉第 $i$ 个元素只算一种方案。)
输入格式
第一行有一个整数 $t$ $(1 < t < 10^4)$ 为测试数据数。
每个测试数据数第一行有一个整数 $n$ $( 3 < n < 2*10^5 )$。
下面 $1$ 行有 $n$ 个整数 $a_1,a_2,\dots,a_n$ $(0
输出格式
对于每个测试数据,输出一个整数表示求删掉数组 $a$ 中两个元素后剩下元素算术平均数仍为 $k$ 的方案数。
说明/提示
In the first example, any pair of elements can be removed since all of them are equal.
In the second example, there is no way to delete two elements so the mathematic mean doesn't change.
In the third example, it is possible to delete the elements on positions $ 1 $ and $ 3 $ , or the elements on positions $ 4 $ and $ 5 $ .