Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
157164 陈骏睿 打印每一趟插入排序 C++ Wrong Answer 1 MS 348 KB 590 2026-07-20 12:11:34

Tests(0/4):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a[20001]={}; int t,i,j,n; cin>>n; for(i=0;i<n;i++)cin>>a[i]; for(i=1;i<n;i++){ t=a[i]; for(j=i;i>0;j--){ if(a[j-1]>t)a[j]=a[j-1]; else break; } a[j]=t; for(int k=0;k<n-1;k++)cout<<a[k]<<' '; cout<<a[n-1]<<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 5