Pagini recente » Cod sursa (job #3175614) | Cod sursa (job #133232) | Cod sursa (job #2877117) | Cod sursa (job #586421) | Cod sursa (job #129713)
Cod sursa(job #129713)
var f1,f2:text;
i,n,sc,st,m,l,u,spt,spc,x:longint;
s,sp,mx:double;
c,t:array[-30010..30010] of integer;
procedure hib1;
begin
for i:=l to n do
begin
sc:=sc+c[i]-c[i-u];
st:=st+t[i]-t[i-u];
s:=sc/st;
spc:=sc;
spt:=st;
for x:=u-1 downto l do
begin
spc:=spc-c[i-x];
spt:=spt-t[i-x];
sp:=spc/spt;
if sp>s then
s:=sp;
end;
if s>mx then
mx:=s;
end;
end;
procedure hib2;
begin
for i:=l to n do
begin
inc(m);
sc:=sc+c[i]-c[i-l];
st:=st+t[i]-t[i-l];
s:=sc/st;
if s>mx then
mx:=s;
end;
end;
begin
assign(f1,'secv3.in');
reset(f1);
assign(f2,'secv3.out');
rewrite(f2);
read(f1,n,l,u);
for i:=1 to n do
read(f1,c[i]);
for i:=1 to n do
read(f1,t[i]);
for i:=1 to l-1 do
begin
sc:=sc+c[i];
st:=st+t[i];
end;
m:=l-1;
if n<10000 then
hib1
else hib2;
writeln(f2,mx:0:7);
close(f1);
close(f2);
end.