LEM1 - COIN
Tác giả: khuc_tuan
Ngôn ngữ: Pascal
uses math;
var
n, i, kk, j,t : integer;
r : array[1..10000] of double;
xx,total, left, right, mid : double;
ok : boolean;
function tinh(a,b,c : double) : double;
var
xx : double;
begin
xx := (b*b+c*c-a*a)/2/b/c;
if(xx>=1-1e-8) then xx := 1;
if(xx<=-1+1e-8) then xx := -1;
tinh := arccos(xx);
end;
begin
read(n);
for i:=1 to n do read(r[i]);
//for i:=1 to n do r[i] := 100000;
left := 0;
right := 1e9;
for kk:=1 to 50 do begin
mid := (left+right)/2;
total := 0;
ok := true;
for i:=1 to n do begin
t := i-1;
if t=0 then t := n;
j := i mod n + 1;
xx := tinh( r[i]+r[j], r[i]+mid, r[j]+mid) ;
//if( tinh(r[t]+r[i],r[t]+mid,r[i]+mid) + xx <= tinh( r[t]+r[j], r[t]+mid,r[j]+mid)-1e-8) then ok := false;
total := total + xx;
end;
//if not ok then right := mid else
if(total >= 2*3.1415926535) then left := mid
else right := mid;
{writeln( ok);
writeln( total); }
end;
writeln( left:0:3);
end.