| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 70234 | 何子文 | 打印每一趟冒泡排序 | C++ | Accepted | 1 MS | 264 KB | 421 | 2024-04-14 11:08:57 |
#include <bits/stdc++.h> using namespace std; int a[10001], n; int j = 0, flag = 0; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n - 1; i++) { for (j = 0; j < n - 1 - i; 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; }