Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
134294 李树强 求逆序对数 C++ 通过 100 0 MS 244 KB 288 2024-03-02 15:27:11

Tests(8/8):


#include<iostream> using namespace std; const int N = 1e3 + 10; int n, a[N], cnt = 0; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ if(a[i] > a[j]) cnt++; } } cout << cnt; }


测评信息: