Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85115 尚雨钒 打印每一趟选择排序 C++ Wrong Answer 1 MS 272 KB 407 2024-07-16 16:25:11

Tests(0/4):


Code:

#include<bits/stdc++.h> #include <cmath> using namespace std; int main() { int n; cin>>n; int a[2000]; int t,j; for(int b=0; b<n; b++) { cin>>a[b]; } for(int i=1; i<n; i++) { t=a[i]; for(j=i; j>0; j--) { if(t<a[j-1]) { a[j]=a[j-1]; } else { break; } } a[j]=t; for(int k=0; k<n; k++) { cout<<a[k]<<" "; } cout<<endl; } 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-----
5 8 5 2 9 5 5 8 2 9 2 5 5 8 9 2 5 5 8 9