| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 85042 | 陈俊洁 | 打印每一趟冒泡排序 | C++ | Wrong Answer | 1 MS | 280 KB | 373 | 2024-07-16 16:13:43 |
#include<bits/stdc++.h> using namespace std; int main() { int a[2001]; int t,j,n; cin>>n; for(int i=1;i<n;i++){ cin>>a[i]; } for(int i=1;i<n;i++){ t=a[i]; for(j=1;j>0;j--){ if(a[i]<a[j-1]){ a[j]=a[j-1];//往后移 } else{ break; } } a[j]=t;//插入 } for(int i=0;i<n;i++){ cout<<a[i]<<' '; } return 0; }
------Input------
5 5 4 3 2 1
------Answer-----
4 3 2 1 5 3 2 1 4 5 2 1 3 4 5 1 2 3 4 5
------Your output-----
0 2 4 3 2