Pagini recente » Cod sursa (job #366385) | Cod sursa (job #2317513) | Cod sursa (job #1846570) | Cod sursa (job #1605760) | Cod sursa (job #301169)
Cod sursa(job #301169)
var a,b:array[0..50000] of integer;
c,t:array[0..50000] of longint;
tot:array[1..50000] of real;
n,l,u,i,st,dr:longint;
min,max,rez:real;
begin
assign(input,'secv3.in'); reset(input);
assign(output,'secv3.out');rewrite(output);
readln(n,l,u);
for i:=1 to n do read(a[i]);
readln;
for i:=1 to n do read(b[i]);
for i:=1 to n do
begin
c[i]:=c[i-1]+a[i];
t[i]:=t[i-1]+b[i];
tot[i]:=c[i]/t[i];
end;
for i:=L to n do if tot[i]>max then
begin
max:=tot[i];
DR:=i;
end;
max:=0;
for i:=dr-L downto dr-U do
begin
if (c[dr]-c[i])/(t[dr]-t[i])>max then
begin
max:=(c[dr]-c[i])/(t[dr]-t[i]);
st:=i;
end;
end;
rez := (c[dr]-c[st])/(t[dr]-t[st]);
writeln(rez:0:2);
close(input); close(output);
end.