求修正

P1716 双调序列

AC代码: ``` #include<bits/stdc++.h> #define f(i,a,b) for(int i=a;i<=b;i++) using namespace std; typedef long long ll; const int N=1000005; ll n,m,num,sum,ans,a[N]; int main() { ios::sync_with_stdio(false); cin>>n; f(i,1,n) cin>>a[i]; sort(a+1,a+1+n);//先排序 ll l=1,r=n; f(i,1,n/2){ cout<<a[r]<<endl<<a[l]<<endl;//先输出最大最小 r--; l++;//然后是第二大第二小 } if(n%2!=0) cout<<a[(1+n)/2]; return 0; } ``` 这道题 有手就行!!! # 但是小狗没手
by cat_YIN @ 2023-08-17 08:59:49


@[cat_YIN](/user/964276) 小狗
by wczxluo @ 2023-08-18 16:23:26


@[wczxluo](/user/976067) 每亩狗
by cat_YIN @ 2023-08-18 16:24:49


|