首页 > 其他分享 >oj 1058

oj 1058

时间:2022-12-10 19:33:35浏览次数:38  
标签:std oj 1058 pos int include

#include <iostream>
#include <algorithm>
using namespace std;

int main(){
int n;
cin>>n;
int a[n+1],b[n+1];
for(int i=1;i<=n;i++) cin>>a[i];

sort(a+1,a+n+1);
int f=1,j=0,pos=(n+1)/2;
b[(n+1)/2]=a[n];

for(int i=n-1;i>=1;i--){
j++;
pos=pos+f*j;
b[pos]=a[i];
f=-f;
}

for(int i=1;i<=n;i++)
cout<<b[i]<<" ";
return 0;
}

标签:std,oj,1058,pos,int,include
From: https://www.cnblogs.com/jianyuzhi/p/16972158.html

相关文章