Cod sursa(job #277887)

Utilizator cheery_g1rlHaller Emanuela cheery_g1rl Data 11 martie 2009 22:56:40
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);
read(c[1]);
for i:=2 to n do begin read(c[i]); c[i]:=c[i]+c[i-1];end;
readln;
read(t[1]);
for i:=2 to n do begin read(t[i]); 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.