Pagini recente » Cod sursa (job #162666) | Cod sursa (job #1752638) | Cod sursa (job #3204151) | Cod sursa (job #184974) | Cod sursa (job #1291)
Cod sursa(job #1291)
program sec3;
type ta=array [0..1000] of longint;
var scost,stimp,cost,timp:ta;
n,l,u,i,j:integer;
f:text;
intr,frac,co,ti:longint;
max:real;
begin {pp}
assign(f,'secv3.in');reset(f);
readln(f,n,l,u);
scost[0]:=0;
for i:=1 to n do
begin
read(f,cost[i]);
scost[i]:=scost[i-1]+cost[i];
end;
readln(f);
stimp[0]:=0;
for i:=1 to n do
begin
read(f,timp[i]);
stimp[i]:=stimp[i-1]+timp[i];
end;
close(f);
max:=0;
for i:=l to n do
for j:=0 to u-l do
begin
co:=scost[i+j]-scost[i-1];
ti:=stimp[i+j]-stimp[i-1];
if (co/ti)>max then max:=co/ti;
end;
intr:=trunc(max);
frac:=trunc((max-intr)*100);
assign(f,'secv3.out');rewrite(f);
write(f,intr,'.',frac);
close(f);
end.