Cod sursa(job #338609)

Utilizator johnyJohny Deep johny Data 6 august 2009 12:17:30
Problema Secventa 3 Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.68 kb
var n,l,u,j,i:longint;
    max,s1,s2,s:real;
    c,t:array[1..50000]of integer;
begin
assign(input,'secv3.in');reset(input);
assign(output,'secv3.out');rewrite(output);
readln(n,l,u);max:=-30000;

for i:=1 to n div 2 do read(c[2*i-1],c[2*i]);
if n mod 2=1 then read(c[n]);
readln;
for i:=1 to n div 2 do read(t[2*i-1],t[2*i]);
if n mod 2=1 then read(t[n]);

for j:=1 to n-l do begin
    s1:=0;s2:=0;
    for i:=j+1 to n do begin
        s1:=s1+c[i];s2:=s2+t[i];
        if s2<>0 then
        s:=s1/s2;
        if (i-j+1>u) then break;
        if (i-j+1>=l) then
           if s>max then max:=s;
        end;
end;
writeln(max:0:2);
close(input);close(output);
end.