Pagini recente » Cod sursa (job #194805) | Cod sursa (job #3286640) | Cod sursa (job #2017668) | Cod sursa (job #2068139) | Cod sursa (job #1289)
Cod sursa(job #1289)
program sec3;
type ta=array [0..10000] 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,'sec3.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,'sec3.out');rewrite(f);
write(f,intr,'.',frac);
close(f);
end.