Cod sursa(job #277883)

Utilizator cheery_g1rlHaller Emanuela cheery_g1rl Data 11 martie 2009 22:55:01
Problema Secventa 3 Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.55 kb
var c,t:array[0..30000] of longint;
   max,s:real;
   i,j,n,l,u:integer;
begin
assign(input,'secv3.in'); reset(input);
assign(output,'secv3.out'); rewrite(output);
readln(n,l,u);
for i:=1 to n do read(c[i]);
readln;
for i:=1 to n do read(t[i]);
for i:=2 to n do
  begin
    c[i]:=c[i]+c[i-1];
    t[i]:=t[i]+t[i-1];
  end;
c[0]:=0;
t[0]:=0;
max:=0;
for i:=1 to n+1-l do
   for j:=i+l-1 to i+u-1 do
     begin
       s:=(c[j]-c[i-1])/(t[j]-t[i-1]);
       if s>max then max:=s;
     end;
writeln(max:10:2);
close(input);
close(output);
end.