其他分享
首页 > 其他分享> > P1116 车厢重组

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;
}

标签:info,重组,cnt,P1116,int,cin,++,车厢
来源: https://www.cnblogs.com/pannnn/p/15854513.html