Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
127418 | 伍逸 | 车厢重组 | C++ | 运行超时 | 83 | 1000 MS | 440 KB | 285 | 2024-01-25 09:00:45 |
#include<bits/stdc++.h> using namespace std; int main(){ int n;cin>>n; int a[n]; for(int i=1;i<=n;i++)cin>>a[i]; int tmp,c=0; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ if(a[i]>a[j]){ tmp=a[i]; a[i]=a[j]; a[j]=tmp; c++; } } } cout<<c; }