| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 151980 | 田子熙 | 打印每一趟选择排序 | C++ | Wrong Answer | 1 MS | 272 KB | 332 | 2026-04-19 13:08:03 |
#include <iostream> using namespace std; int main() { int n,x; cin>>n; int a[n+3]; for (int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<n;i++) { for(int j=i;j>0;j--) { if(a[j]<a[j-1]){ swap(a[j],a[j-1]); } } 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-----
5 8 5 2 9 5 8 5 2 9 5 5 8 2 9 2 5 5 8 9 2 5 5 8 9