Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
152187 万骏博 打印每一趟选择排序 C++ Wrong Answer 1 MS 264 KB 413 2026-04-21 21:58:52

Tests(0/4):


Code:

#include <bits/stdc++.h> using namespace std; int n,a[100000],l=0; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ scanf("%d",&a[i]); } for(int i=1;i<=n;i++){ int p=a[i]; l=i; for(int j=i;j<=n;j++){ if(a[j]<p){ p=a[j]; l=j; } } int q=a[l]; a[l]=a[i]; a[i]=q; for(int j=1;j<=n;j++){ printf("%d ",a[j]); } printf("\n"); } 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 8 5 5 9 2 5 8 5 9 2 5 5 8 9 2 5 5 8 9 2 5 5 8 9