思路
排序之后输出开头和结尾即可
#include <bits/stdc++.h>
using namespace std ;
const int N = 1e4 + 5 ;
int n ;
int main ( ) {
while ( cin >> n ) {
int s[N] ;
for ( int i = 1 ; i <= n ; i ++ ) cin >> s[i] ;
sort ( s + 1 , s + n + 1 ) ;
cout << s[n] << ' ' << s[1] << endl ;
}
return 0 ;
}