| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 70252 | 袁嘉蔓 | 打印每一趟冒泡排序 | C++ | Wrong Answer | 0 MS | 348 KB | 367 | 2024-04-14 11:14:13 |
#include<bits/stdc++.h> using namespace std; int main(){ int n[20000]={0}; int a; cin>>a; for(int i=0;i<a;i++){ cin>>n[i]; } for (int i=0;i<a-1;i++){ for(int j=0;j<a-1-i;j++){ if(n[j]>n[j+1]){ swap(n[j],n[j+1]); for (int q=0;q<=10;q++){ cout<<n[q]<<" "; } cout<<endl; } } } 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-----
4 5 3 2 1 0 0 0 0 0 0 4 3 5 2 1 0 0 0 0 0 0 4 3 2 5 1 0 0 0 0 0 0 4 3 2 1 5 0 0 0 0 0 0 3 4 2 1 5 0 0 0 0 0 0 3 2 4 1 5 0 0 0 0 0 0 3 2 1 4 5 0 0 0 0 0 0 2 3 1 4 5 0 0 0 0 0 0 2 1 3 4 5 0 0 0 0 0 0 1 2 3 4 5 0 0 0 0 0 0