Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
113746 | 陈昊然 | 打印每一趟冒泡排序 | C++ | Accepted | 1 MS | 276 KB | 346 | 2025-03-16 14:12:44 |
#include<bits/stdc++.h> using namespace std; int n; int s[2001]; int main() { cin>>n; for(int i=0; i<n; i++) { cin>>s[i]; } for(int i=0; i<n-1; i++) { for(int j=0; j<n-1; j++) { if(s[j]>s[j+1]) { swap(s[j],s[j+1]); } } for(int i=0; i<n; i++) { cout<<s[i]<<" "; } cout<<endl; } return 0; }