-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUva1260.cpp
More file actions
39 lines (35 loc) · 739 Bytes
/
Copy pathUva1260.cpp
File metadata and controls
39 lines (35 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;
int main()
{
int tc;
scanf("%d",&tc);
while(tc--){
int num;
scanf("%d",&num);
vector<int> coll;
for(int i=0;i<num;i++){
int c;
scanf("%d",&c);
coll.push_back(c);
}
vector<int> resVec(coll.size(),0);
for(int i=1;i<coll.size();i++){
for(int j=0;j<i;j++){
if(coll[i]>=coll[j])resVec[i]++;
}
}
int sum=0;
for(int i : resVec)sum+=i;
cout<<sum<<endl;
}
return 0;
}