FZU 2134 上车

来源:互联网 发布:方正锐正黑系列 mac 编辑:程序博客网 时间:2024/05/02 00:36

题目链接: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;}


0 0
原创粉丝点击