Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
141346 黄枳润 打印每一趟选择排序 C++ Wrong Answer 1 MS 272 KB 701 2025-12-22 19:00:54

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


Run Info:

------Input------
5 5 8 5 2 9
------Answer-----
2 8 5 5 9 2 5 8 5 9 2 5 5 8 9 2 5 5 8 9
------Your output-----
2 5 5 8 9 2 5 5 8 9 2 5 5 8 9 2 5 5 8 9