LEM1 - COIN
Tác giả: flashmt
Ngôn ngữ: Pascal
const fi='';
fo='';
maxn=10005;
ep=0.000000001;
pi2=6.283185307;
var n:longint;
a:array[1..maxn] of real;
re:real;
procedure rf;
var i:longint;
begin
assign(input,fi); reset(input);
readln(n);
for i:=1 to n do read(a[i]);
close(input);
end;
function calc(x:real):longint;
var i,z:longint; goc,cosin,tg,b,c,d:real;
begin
goc:=0;
for i:=1 to n do
begin
z:=i+1;
if z=n+1 then z:=1;
b:=x+a[i]; c:=x+a[z]; d:=a[i]+a[z];
cosin:=(b*b+c*c-d*d)/(2*b*c);
tg:=sqrt((1-sqr(cosin))/sqr(cosin));
if cosin>=0 then goc:=goc+arctan(tg)
else goc:=goc+pi2/2-arctan(tg);
end;
if abs(goc-pi2)<=ep then calc:=0
else
if goc>pi2 then calc:=1
else calc:=-1;
end;
procedure pr;
var l,m,r:real; t:longint;
begin
l:=0; r:=1000000000000000000000000;
while r-l>=ep do
begin
m:=(l+r)/2;
t:=calc(m);
if t=0 then break;
if t>0 then l:=m
else r:=m;
end;
re:=m;
end;
procedure wf;
begin
assign(output,fo); rewrite(output);
writeln(re:0:3);
close(output);
end;
begin
rf;
pr;
wf;
end.