Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141341 黄枳润 打印每一趟插入排序 C++ Wrong Answer 0 MS 272 KB 695 2025-12-22 18:56:13

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 n,t; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } for(int i=0;i<n-1;i++){ for(int j=1;j<n-1-i;j++){ for(int z=0;z<n+j-n;z++) if(a[j]>a[j+1]){ t=a[j]; a[j]=a[j+1]; a[j+1]=t; } } for(int i=0;i<n;i++){ cout<<a[i]<<' '; } } 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 1 9 5 2 1 7 9 5 1 2 7 9 5 1 2 7 9