P1116 车厢重组

// Problem: P1116 车厢重组
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P1116
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// User: Pannnn

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    
    vector<int> info(n);
    for (int i = 0; i < n; ++i) {
        cin >> info[i];
    }
    
    long long cnt = 0;
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (info[i] > info[j]) {
                ++cnt;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}
上一篇:P2676 [USACO07DEC]Bookshelf B


下一篇:Note:大学日语基础篇语法总结(*)