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

Tests(4/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;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; }