| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 114778 | 石晋骁 | 打印每一趟选择排序 | C++ | Wrong Answer | 1 MS | 268 KB | 418 | 2025-03-23 14:25:15 |
#include<bits/stdc++.h> using namespace std; int a[200]; int n; int main(){ cin >> n; for(int i = 0;i < n;i++){ cin >> a[i]; } for(int i = 0;i <= n-1;i++){ int min_j = i; for(int j = i;j < n;j++){ if(a[j] < a[min_j]){ min_j = j; } } if(i != min_j){ swap(a[i],a[min_j]); } 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 8 5 5 9 2 5 8 5 9 2 5 5 8 9 2 5 5 8 9 2 5 5 8 9