Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
38695 | 黄晟睿 | 打印每一趟插入排序 | C++ | Accepted | 1 MS | 276 KB | 348 | 2022-09-17 09:51:40 |
#include<bits/stdc++.h> using namespace std; int main(){ int a[5001]; int t,j; int n; cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ t=a[i]; for(j=i;j>0;j--){ if(a[j-1]>t) a[j]=a[j-1]; else break; } a[j]=t; for(int i=0;i<n;i++){ cout<<a[i]<<" "; } cout<<endl; } return 0; }