Cod sursa(job #338573)

Utilizator johnyJohny Deep johny Data 6 august 2009 08:38:40
Problema Secventa 3 Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.75 kb
var n,l,u,j,i:longint;max,s1,s2,s:real;
    v,f: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 5 do
begin
  j:=(i-1)*5;
  read(v[j+1],v[j+2],v[j+3],v[j+4],v[j+5]);
end;
for j:=n-(n mod 5)+1 to n do read(v[j]);

readln;

for i:=1 to n do
begin
  j:=(i-1)*5;
  read(f[j+1],f[j+2],f[j+3],f[j+4],f[j+5]);
end;
for j:=n-(n mod 5)+1 to n do read(f[j]);



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