| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 85133 | 陈俊洁 | 打印每一趟插入排序 | C++ | Wrong Answer | 0 MS | 280 KB | 348 | 2024-07-16 16:29:55 |
#include<bits/stdc++.h> using namespace std; int main() { int a[2001]; int t,j,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(t<a[j-1]){ a[j]=a[j-1];//往后移 } else{ break; } } a[j]=t;//插入 cout<<a[i]<<' '<<endl; } return 0; }
------Input------
5 5 2 7 9 1
------Answer-----
2 5 7 9 1 2 5 7 9 1 2 5 7 9 1 1 2 5 7 9
------Your output-----
5 7 9 9