Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85101 赵文浚 打印每一趟插入排序 C++ Wrong Answer 1 MS 268 KB 404 2024-07-16 16:22:26

Tests(0/4):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int a[2001],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(t<a[j-1]) { a[j]=a[j-1]; } else { break; } a[j]=t; for(int b=0;b<n;b++) { cout<<a[b]<<" "; } cout<<endl; } } return 0; }


Run Info:

------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 2 7 9 1 5 2 7 9 1 5 2 7 1 1 5 2 1 1 1 5 1 1 1 1