CF1487A.Arena

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

nn heroes fight against each other in the Arena. Initially, the ii -th hero has level aia_i .

Each minute, a fight between two different heroes occurs. These heroes can be chosen arbitrarily (it's even possible that it is the same two heroes that were fighting during the last minute).

When two heroes of equal levels fight, nobody wins the fight. When two heroes of different levels fight, the one with the higher level wins, and his level increases by 11 .

The winner of the tournament is the first hero that wins in at least 100500100^{500} fights (note that it's possible that the tournament lasts forever if no hero wins this number of fights, then there is no winner). A possible winner is a hero such that there exists a sequence of fights that this hero becomes the winner of the tournament.

Calculate the number of possible winners among nn heroes.

输入格式

The first line contains one integer tt ( 1t5001 \le t \le 500 ) — the number of test cases.

Each test case consists of two lines. The first line contains one integer nn ( 2n1002 \le n \le 100 ) — the number of heroes. The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n ( 1ai1001 \le a_i \le 100 ), where aia_i is the initial level of the ii -th hero.

输出格式

For each test case, print one integer — the number of possible winners among the given nn heroes.

输入输出样例

  • 输入#1

    3
    3
    3 2 2
    2
    5 5
    4
    1 3 3 7

    输出#1

    1
    0
    3

说明/提示

In the first test case of the example, the only possible winner is the first hero.

In the second test case of the example, each fight between the heroes results in nobody winning it, so the tournament lasts forever and there is no winner.

首页