提交时间:2023-08-23 10:53:52

运行 ID: 99585

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