Tìm trong 10000000 số ****nacy đầu tiên chia hết cho 10000, in ra file ****n.txt số thứ tự các số đó(số thứ mây, vd 8 là số ****nacy thứ 6).

program ****nacy;
const
fo='****.txt';
max=10000000;
var
f:text;
i:longint;
st1,st2,s:string;

function plus(st1,st2:string):string;
var
a,i,j,n,m,k:integer;
st:string;
begin
if length(st1)<length(st2) then
begin
j:=length(st2)-length(st1);
for i:=1 to j do
st1:='0'+st1;
end
else
begin
j:=length(st1)-length(st2);
for i:=1 to j do
st2:='0'+st2;
end;
st:='';
k:=0;
for i:=length(st2) downto 1 do
begin
val(st1[i],n,a);
val(st2[i],m,a);
a:=m+n+k;
k:=0;
if a>9 then
begin
a:=a-10;
k:=1;
end;
st:=chr(a+48)+st;
end;
if k>0 then
st:='1'+st;
plus:=st;
end;

function test(st:string):boolean;
var
i:byte;
begin
if length(st)>=5 then
begin
test:=true;
for i:=length(st)-3 to length(st) do
if st[i]<>'0' then
begin
test:=false;
break;
end;
end
else
test:=false;
end;

begin
i:=2;
st1:='1';
st2:='1';
assign(f,fo);
rewrite(f);
while i<=1000000 do
begin
s:=st1;
i:=i+1;
st1:=plus(st1,st2);
st2:=s;
if test(st1)=true then
writeln(f,i,' : ',st1);
end;
close(f);
end.