Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

注意小数点,整数后有1位0

Posted by xuyujie at 2013-10-06 15:10:12 on Problem 2623
注意小数点,整数后有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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator