Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int amounts[1003];
- int main()
- {
- int test,i,j,n,sum,cnt;
- scanf("%d",&test);
- while(test--)
- {
- scanf("%d",&n);
- for(i=1; i<=n; i++)
- {
- scanf("%d",&amounts[i]);
- }
- sum = 0;
- for(i=2; i<=n; i++)
- {
- cnt = 0;
- for(j=i-1; j>=1; j--)
- {
- if(amounts[i]>=amounts[j])
- {
- cnt++;
- }
- }
- sum+=cnt;
- }
- printf("%d\n",sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment