文章
111
粉丝
69
获赞
180
访问
66.2k
#include<bits/stdc++.h>
using namespace std;
int n;
vector<int> a;
int main()
{
while(cin >> n)
{
a.clear();
for(int i = 0; i < n; i ++)
{
int x;
scanf("%d", &x);
a.push_back(x);
}
sort(a.begin(), a.end());
int ans = a.back();
printf("%d\n", ans);
a.pop_back();
if(a.empty())
{
printf("-1\n");
continue;
}
for(auto x : a)
cout << x << " ";
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发