Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
85007 | 游四鑫 | 打印每一趟插入排序 | C++ | Accepted | 1 MS | 304 KB | 456 | 2024-07-16 16:10:42 |
#include<iostream> using namespace std; int main(){ int n; int a[10000]={0}; int t,j; cin>>n; for(int k=0;k<n;k++){ cin>>a[k]; } for(int i=1;i<n;i++){ t=a[i]; for(j=i;j>0;j--){ if(t<a[j-1]){ a[j]=a[j-1]; } else{ break; } } a[j]=t; for(int w=0;w<n;w++){ cout<<a[w]<<' '; } cout<<endl; } return 0; }