Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
113763 | 刘慕莀 | 优化冒泡排序 | C++ | Accepted | 5 MS | 276 KB | 319 | 2025-03-16 14:15:16 |
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n],t; for(int c=0;c<n;c++){ cin>>a[c]; } for(int i=0;i<n-1;i++){ for(int j=0;j<n-i-1;j++){ if(a[j]<a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } } for(int k=0;k<n;k++){ cout<<a[k]<<' '; } return 0; }