#include<stdio.h> main(){ int n; scanf("%d",&n); int a[n]; for(int i=0;i<n;i++){ scanf("%d",&a[i]); } int temp=0; for(int i=0;i<n-1;i++){ for(int j=i+1;j<n;j++){ if(a[i]>a[j]){ temp=a[i]; a[i]=a[j]; a[j]=temp; } } } printf("%d",a[n/2]); }
扫描二维码,关注牛客
下载牛客APP,随时随地刷题
全部评论
(2) 回帖