mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-30 19:51:58 +00:00
26 lines
483 B
C++
26 lines
483 B
C++
// R38788162
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
int n, a[10005], ans = 0;
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++) {
|
|
cin >> a[i];
|
|
}
|
|
for (int i = 0; i < n; i++) {
|
|
for (int j = 1; j < n; j++) {
|
|
if (a[j] < a[j - 1]) {
|
|
a[j] ^= a[j - 1];
|
|
a[j - 1] ^= a[j];
|
|
a[j] ^= a[j - 1];
|
|
ans++;
|
|
}
|
|
}
|
|
}
|
|
cout << ans << endl;
|
|
return 0;
|
|
}
|