| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 141347 | 黄枳润 | 打印每一趟选择排序 | C++ | Wrong Answer | 0 MS | 272 KB | 706 | 2025-12-22 19:01:34 |
#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]<<' '; }cout<<endl; } return 0; }
------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