文章
55
粉丝
100
获赞
12
访问
31.1k
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
int n ;
while(cin>>n){
int arr[1000] = {0};
for(int i = 0; i<n; i++){
cin>>arr[i];
}
int max = 0;
for(int i = 0; i<n; i++){
if(arr[i]>arr[max]){
max = i;
}
}
cout<<arr[max]<<endl;
for(int i = max; i<n-1; i++){
arr[i] = arr[i+1];
}
n--;
if(n!=0){
sort(arr,arr+n);
for(int i = 0; i<n; i++){
cout<<arr[i]<<" ";
}
}else{
cout<<-1;
}
cout<<endl;
}
}
登录后发布评论
暂无评论,来抢沙发