| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 84722 | 尚雨钒 | 打印每一趟冒泡排序 | C++ | Wrong Answer | 1 MS | 280 KB | 384 | 2024-07-16 11:38:59 |
#include<bits/stdc++.h> #include <cmath> using namespace std; int main() { int N; cin>>N; int a[2000],t; for(int b=0; b<N; b++) { cin>>a[b]; } for(int i=0; i<N; i++) { for(int j=0; j<N-i-1; j++) { if(a[j]>a[j+1]) { t=a[j+1]; a[j+1]=a[j]; a[j]=t; } } for(int k=0; k<N; k++) { cout<<a[k]<<" "; } 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 3 2 1 5 3 2 1 4 5 2 1 3 4 5 1 2 3 4 5 1 2 3 4 5