KBFqiufeng @ 2024-09-07 22:32:45
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,a[500010],num=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if(a[i]>a[j])num++;
}
}
printf("%d",num);
return 0;
}
by meifan666 @ 2024-09-07 22:35:45
@KBFqiufeng
by KBFqiufeng @ 2024-09-07 22:38:19
@meifan666 好的,谢谢大佬