

Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
const fi='cfibo.inp';
fo='cfibo.out';
maxn=round(1e8);
var m,n,d:qword;
i:longint;
a: array [0..maxn] of int64;
b: array [0..maxn] of boolean;
procedure ganfibo;
begin
fillchar(b,sizeof(d),false);
a[0]:=0;
a[1]:=1;
for i:= 2 to n do a[i]:=a[i-1]+a[i-2];
for i:=0 to n do
b[a[i]]:=true;
end;
begin
assign(input,fi);
reset(input);
read(m,n);
close(input);
ganfibo;
for i:=m to n do
if b[i] then inc(d);
assign(output,fo);
rewrite(output);
write(d);
close(output);
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
var a,b,d:int64;
i:longint;
f:array[-1..10000] of int64;
begin
assign(input,'CFIBO.INP');reset(input);
assign(output,'CFIBO.OUT');rewrite(output);
readln(a,b);
f[-1]:=1;
f[0]:=0;
d:=0;
i:=0;
while f[i]<=b do
begin
if (f[i]>=a) and (f[i]<=b) then
inc(d);
inc(i);
f[i]:=f[i-1]+f[i-2];
end;
writeln(d);
readln;
end.Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin