Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
129451 常钰杰 初级冒泡排序 C++ Accepted 7 MS 276 KB 546 2025-08-25 16:59:46

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n + 1]; int t; for(int i = 1; i <= n; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { for(int j = n; j > i; j--) { if(a[j] > a[j - 1]) { t = a[j]; a[j] = a[j - 1]; a[j - 1] = t; } } } for(int i = 1; i <= n; i++) { cout << a[i] << " "; } return 0; }