#C2388. Count Higher Score Pairs
Count Higher Score Pairs
Count Higher Score Pairs
You are given multiple test cases. In each test case, you will receive an even number of integers representing scores of two players in consecutive pairs. For each pair, if the first player's score is greater than the second player's score, then the pair is considered a valid pair. Your task is to count the valid pairs for each test case.
Formally, for a test case with an even number n and scores \(a_1,a_2,\ldots,a_n\), you should compute the value
[ \text{Result} = \sum_{i=1}^{n/2} \mathbf{1}{a{2i-1} > a_{2i}}, ]
where \(\mathbf{1}_{\text{condition}}\) is 1 if the condition is true and 0 otherwise.
inputFormat
The first line of input contains an integer \(T\) representing the number of test cases. Each test case is described in a single line that begins with an even integer \(N\) (the number of scores), followed by \(N\) integers representing the scores. The scores are organized in pairs, where the first number of each pair is the score of the first player and the second is the score of the second player.
For example:
2
4 10 5 7 3
4 6 8 15 14
outputFormat
For each test case, output a single integer on its own line representing the number of pairs where the first score is higher than the second score.
## sample2
4 10 5 7 3
4 6 8 15 14
2
1
</p>