| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 149589 | 陈棋 | 优化冒泡排序 | C++ | Accepted | 7 MS | 280 KB | 345 | 2026-03-14 16:26:42 |
#include<bits/stdc++.h> using namespace std; int main(){ int n,a[2001],temp; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-1-i;j++){ if(a[j]<a[j+1]){ temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } for(int i=0;i<n;i++){ cout<<a[i]<<" "; } return 0; }