Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
109561 邓泊修 打印每一趟选择排序 C++ Wrong Answer 1 MS 272 KB 778 2025-02-09 15:04:21

Tests(1/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() #include<ctime> using namespace std; int main() { int i,j,k,a,b,z,x[1000]; cin>>a; for(i=0;i<a;i++) { cin>>x[i]; } for(i=0;i<a-1;i++) { b=i; for(j=i;j<a-1;j++) { if(x[b]>x[j]) { b=j; } } z=x[b]; x[b]=x[i]; x[i]=z; cout<<x[0]; for(k=1;k<a;k++) { cout<<' '<<x[k]; } cout<<endl; } return 0; }


Run Info:

------Input------
5 5 4 3 2 1
------Answer-----
1 4 3 2 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
------Your output-----
2 4 3 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1