题目链接:FZU 2134 上车
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAX_N = 100 + 10;
int arr[MAX_N];
int main()
{
int T;
scanf("%d", &T);
while(T--)
{
memset(arr, 0, sizeof(arr));
int n, temp, res = 0;
scanf("%d", &n);
for(int i = 0; i < n; i++)
{
scanf("%d", &temp);
arr[temp]++;
for(int j = 1; j < temp; j++)
res += arr[j];
}
printf("%d\n", res);
}
return 0;
}