Run ID:109061

提交时间:2025-01-25 10:52:44

#include <iostream> #include <algorithm> int main() { const int MAX_SIZE = 100; int n, a[MAX_SIZE]; std::cin >> n; if (n <= 0 || n > MAX_SIZE) { std::cout<< std::endl; return 1; } for (int i = 0; i < n; i++) { std::cin >> a[i]; } for (int i = 0; i < n; i++) { for (int j = 0; j < n - i - 1; j++) { if (a[j] < a[j + 1]) { std::swap(a[j], a[j + 1]); } } } std::cout << std::endl; for (int i = 0; i < n; i++) { std::cout << a[i] << std::endl; } return 0; }