Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
4589 吴奕希 打印每一趟冒泡排序 C++ Accepted 0 MS 272 KB 458 2024-08-23 11:08:36

Tests(3/3):


Code:

# include<iostream> using namespace std; int main() { int l,n = 0; cin>>n; int lst[2001]={}; for(int i = 0; i < n; i++){ cin>>lst[i]; } for(int a = 0; a < n-1; a++){ for(int b = 1; b < n; b++)if(lst[b-1]>lst[b]){ l = lst[b]; lst[b] = lst[b-1]; lst[b-1] = l; } for(int b = 0; b < n; b++)cout<<lst[b]<<" "; cout<<endl; } return 0; }