| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 102179 | 梁乃元 | 求逆序对数 | C++ | Accepted | 100 | 0 MS | 244 KB | 407 | 2023-09-12 13:46:45 |
# include <iostream> # include <cstring> # include <algorithm> using namespace std ; int a [1145] ; int main ( ) { int n ; cin >> n ; for ( int i = 1 ; i <= n ; i ++ ) { cin >> a [i] ; } int cnt = 0 ; for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( a [i] > a [j] ) { cnt ++ ; } } } cout << cnt << endl ; return 0 ; }