提交时间:2023-09-09 11:30:33
运行 ID: 101626
#include <iostream> #include <algorithm> using namespace std ; int a [114514] ; int main ( ) { int n ; cin >> n ; for ( int i = 1 ; i <= n + 1 ; i ++ ) { cin >> a [i] ; } for ( int i = 1 ; i < n ; i ++ ) { for ( int j = i + 1 ; j <= n ; j ++ ) { if ( a [i] > a [j] ) { swap ( a [i] , a [j] ) ; } } } for ( int i = 1 ; i <= n ; i ++ ) { cout << a [i] ; if ( i == n + 1 ) { cout << endl ; } else { cout << ' ' ; } } return 0 ; }