Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
38696 | 李彦磊 | 打印每一趟插入排序 | C++ | Accepted | 1 MS | 280 KB | 342 | 2022-09-17 09:52:53 |
#include<bits/stdc++.h> using namespace std; int main() { int a[2005]; int n,t,j; 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 x=0;x<n;x++){ cout<<a[x]<<" "; } } return 0; }