简单解法
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
int a[105];
while(cin >> n){
for(int i = 0; i < n; ++i){
cin >> a[i];
}
sort(a, a+n);
cout << a[n-1] << endl;
for(int i = 0; i < n-1; ++i){
cout << a[i] << " ";
}
cout << endl;
}
}
登录后发布评论
暂无评论,来抢沙发