Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
注意小数点,整数后有1位0注意小数点,整数后有1位0 PS:注意用int64 var n,i:longint; a:array[1..1000000] of int64; procedure sort(l,r:int64); var i,j,x,y: int64; begin i:=l; j:=r; x:=a[(l+r) div 2]; repeat while a[i]<x do inc(i); while x<a[j] do dec(j); if not(i>j) then begin y:=a[i]; a[i]:=a[j]; a[j]:=y; inc(i); j:=j-1; end; until i>j; if l<j then sort(l,j); if i<r then sort(i,r); end; begin readln(n); for i:=1 to n do readln(a[i]); sort(1,n); if n mod 2=1 then writeln(a[(n+1) div 2],'.0') else if (a[n div 2]+a[n div 2+1]) mod 2=1 then writeln((a[n div 2]+a[n div 2+1])/2:0:1) else writeln((a[n div 2]+a[n div 2+1])div 2,'.0'); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator