/* yukicoder My Practice * autoher: Leonarone NEETSDKASU ************************************************************************/ #include #include #include #include #include /************************************************************************/ #define MR__BUFSIZE (1000000) typedef struct _string { size_t len; char *data; } string; char mr__buffer[MR__BUFSIZE], *mr__start=mr__buffer; size_t mr__buflen; void solve(void); int main(void) { mr__buflen = fread(mr__buffer, sizeof(mr__buffer[0]), sizeof(mr__buffer) / sizeof(mr__buffer[0]), stdin); if (mr__buflen < MR__BUFSIZE - 1) mr__buffer[mr__buflen] = '\n'; else exit(EXIT_FAILURE); solve(); return 0; } #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define rep(i,s,e) for(i=s;isize=n; r->capa=a; return r; } void extendVec(PPVector p, size_t b) { Vector v=*p;if(v->size==v->capa){v->capa+=V_ALLOCSIZE; v=*p=(Vector)realloc(*p,v->capa*b+sizeof(VectorT));}} #define CUP(a, b) a##b #define CUP3(a, b, c) a##b##c #define VEC_DEF(_T,_I) \ typedef struct CUP3(_,_I,vector) { size_t size; size_t capa; _T value[0]; } CUP(_I,VectorT),*CUP(_I,Vector),**CUP3(PP,_I,Vector); \ CUP(_I,Vector) CUP3(new,_I,V)(size_t n) { return (CUP(_I,Vector))newVec(n,sizeof(_T)); } \ CUP(_I,Vector) CUP3(add,_I,V)(CUP3(PP,_I,Vector) p, _T x) { extendVec((PPVector)p, sizeof(_T)); (*p)->value[(*p)->size++]=x; return *p; } VEC_DEF(int,I); VEC_DEF(string,S); VEC_DEF(IVector,IV); VEC_DEF(SVector,SV); VEC_DEF(char,C); SVector strsplit(string str, char d) {SVector vec=newSV(0);char *e=str.data,*s;string t; for(;;){s=e;while(*e&&*e!=d)e++;if(e==str.data)return vec;t.data=s;t.len=e-s;addSV(&vec,t);if(*e==0)break;*e++=0;}return vec;} string strjoin(SVector v,char d){string t,r={0};int i;for(i=0;isize;i++)r.len+=v->value[i].len;if(d)r.len+=v->size-1; {char *p=r.data=(char*)malloc(sizeof(char)*(r.len+1));for(i=0;isize;i++) {if(i&&d)*p++=d;t=v->value[i];memcpy(p,t.data,t.len*sizeof(char));p+=t.len;}r.data[r.len]=0;}return r;} int isEOF(void) { return *mr__start == '\0'; } void nextLine(void) { while (*mr__start != '\n') mr__start++; *mr__start++ = '\0'; } int ti(string s) { int i,r=0,m=*s.data=='-'; for(i=m;i<(int)s.len;i++)r=r*10+(int)(s.data[i]-'0'); return m ? -r : r; } string gs(void) { string r = {0, mr__start}; nextLine(); r.len = mr__start - r.data - 1; return r; } int gi(void) { return ti(gs()); } SVector gss(void) { return strsplit(gs(), ' '); } IVector gis(void) { SVector v=gss();IVector r=newIV(v->size);int i;for(i=0;isize;i++)r->value[i]=ti(v->value[i]);free(v);return r;} SVector ngs(int n) { SVector r=newSV(n); int i; for(i=0;ivalue[i]=gs(); return r; } IVector ngi(int n) { IVector r=newIV(n); int i; for(i=0;ivalue[i]=gi(); return r; } SVVector ngss(int n) { SVVector r=newSVV(n); int i; for(i=0;ivalue[i]=gss(); return r; } IVVector ngis(int n) { IVVector r=newIVV(n); int i; for(i=0;ivalue[i]=gis(); return r; } int iAsc(const void *a, const void *b) { return *(int*)a - *(int*)b; } int iDec(const void *a, const void *b) { return *(int*)b - *(int*)a; } /************************************************************************/ void solve(void) { int n = gi(); IVector a = gis(); qsort(a->value, a->size, sizeof(int), iAsc); if (n % 2) { printf("%d\n", a->value[n / 2 + 1]); } else { printf("%lf\n", (double)(a->value[n/2] + a->value[n/2-1]) / 2.0); } }