| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 147768 | 谢绍澜 | 打印每一趟冒泡排序 | C++ | Accepted | 0 MS | 272 KB | 732 | 2026-02-07 15:40:32 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<vector> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,t,s; cin>>n; int a[n+1]; for(int i=1;i<=n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ s=0; for(int j=1;j<n-i+1;j++){ if(a[j]>a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; s=1; } } for(int k=1;k<=n;k++){ cout<<a[k]<<" "; } cout<<endl; } return 0; }