Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
84748 游四鑫 打印每一趟冒泡排序 C++ Accepted 1 MS 276 KB 390 2024-07-16 11:48:37

Tests(3/3):


Code:

#include<iostream> using namespace std; int main(){ int t=0,n; int a[10000]; cin>>n; for(int k=0;k<n;k++){ cin>>a[k]; } 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 r=0;r<n;r++){ cout<<a[r]<<' '; } cout<<endl; } return 0; }