提交时间:2023-08-23 09:25:17

运行 ID: 99540

#include <bits/stdc++.h> using namespace std; int a[1145]; int n; signed main() { cin >> n; for(int i = 1; i <= n; i++)cin >> a[i]; int ans = 0; for(int i = 1; i <= n; i++) { for(int j = i+1; j <= n; j++) { if(a[i]>a[j])ans++; } } cout << ans << endl; return 0; }