Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
102224 | 宋春霖 | 插入排序 | C++ | 解答错误 | 0 | 0 MS | 260 KB | 350 | 2023-09-12 13:58:48 |
#include <iostream> using namespace std; int a[10005]; int main(){ int n; cin >> n; for (int i=1; i<=n; i++) cin >> a[i]; bool x = true; while (x){ x = false; for (int i=1; i<=n-1; i++){ if (a[i] > a[i + 1]){ x = true; swap(a[i], a[i + 1]); } } } for (int i=1; i<=n; i++){ cout << a[i] << " "; } }