| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 84747 | 石晋骁 | 打印每一趟冒泡排序 | C++ | Wrong Answer | 0 MS | 272 KB | 409 | 2024-07-16 11:48:17 |
#include<bits/stdc++.h> using namespace std; int arr[2001]; int main(){ int n,t; cin >> n; for(int i =0;i < n;i++){ cin >> arr[i]; } for(int i = 0;i < n-1;i++){ for(int j = 0;j < n-i-1;j++){ if(arr[j] < arr[j+1]){ t = arr[j]; arr[j] = arr[j+1]; arr[j+1] = t; } } for(int k = 0;k < n;k++){ cout << arr[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-----
5 4 3 2 1 5 4 3 2 1 5 4 3 2 1 5 4 3 2 1