首页 > 其他 > 详细

HDU 1029: Ignatius and the Princess IV

时间:2018-07-17 13:09:17      阅读:169      评论:0      收藏:0      [点我收藏+]

5
1 3 2 3 3
11
1 1 1 1 1 5 5 5 5 5 5
7
1 1 1 1 1 1 1

3

5

1

技术分享图片
#include <stdio.h>
#include <stdlib.h>
int cmp(const void *a,const void *b){
    return *(int*)a-*(int*)b;//(从小到大)
}
int nums[1000000];
int main(){
    int n;
    while(scanf("%d",&n)!=EOF){
        for(int i=0;i<n;i++)scanf("%d",&nums[i]);
        qsort(nums,n,sizeof(int),cmp);
        printf("%d\n",nums[n/2]);
    }
    return 0;
}
View Code

 

HDU 1029: Ignatius and the Princess IV

原文:https://www.cnblogs.com/Rhythm-/p/9322665.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!