nyoj1306海拔
生活随笔
收集整理的這篇文章主要介紹了
nyoj1306海拔
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
與50位技術專家面對面20年技術見證,附贈技術全景圖
題目鏈接:http://acm.nyist.net/JudgeOnline/problem.php?pid=1306
題目意思很清楚比如有一個序列n=7,1 2 3 4 5 6 7
按1 2 3 7 6 5 4的格式輸出就行了
AC代碼:
#include <stdio.h> #include <algorithm> using namespace std; int main() {int t, n, i, a[10086];scanf("%d", &t);while(t--) {scanf("%d", &n);for(i = 0; i < n; i++) scanf("%d", &a[i]);sort(a,a+n);for(i = 0; i < (n+1)/2-1; i++) printf("%d ", a[i]);printf("%d ", a[n-1]);for(n = n-2; n >= i; n--) printf("%d ", a[n]);printf("\n");}return 0; }
與50位技術專家面對面20年技術見證,附贈技術全景圖
總結
以上是生活随笔為你收集整理的nyoj1306海拔的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 低代码平台,JeecgBoot v3.0
- 下一篇: nyoj1180Maze