Cod sursa(job #164032)

Utilizator iiipppPUSCASU ION iiippp Data 23 martie 2008 14:17:28
Problema Secventa 3 Scor 50
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.64 kb
const nmax=15000;
var t,c:array[1..nmax] of 1..1000;
i,n,j,l,x,y,u,ll:0..30000;  m,max:real;
s,ss:longint;  f,g:text;
begin
assign(f,'secv3.in');
assign(g,'secv3.out');
reset(f);
rewrite(g);
readln(f,n,l,u);
for i:=1 to n do
read(f,c[i]);
readln(f);
for i:=1 to n do
read(f,t[i]);
 max:=-maxlongint;
for i:= 1 to n do begin
j:=i;   ll:=0;    s:=0;   ss:=0;
repeat
s:=s+c[j];
ss:=ss+t[j];
m:=s/ss;
ll:=ll+1;
if  (m>=max) and (ll>=l)  and (ll<+u) then begin
  max:=m;  x:=i;
              y:=j;
              end;

j:=j+1;
 until j>n;
 writeln;
               end;
   write(g,max:5:2);
   close(g);
   close(f);
   end.