一个最笨的却行之有效的方法:
procedure TForm1.Button1Click(Sender: TObject);
var
i1:integer;
i2:integer;
i3:integer;
i4:integer;
i5:integer;
i6:integer;
i7:integer;
i8:integer;
m:integer;
n:integer;
k:integer;
mm:string;
begin
for i1:=1 to 8 do
begin
for i2:=1 to 8 do
begin
if (i2=i1) then
continue;
for i3:=1 to 8 do
begin
if (i3=i1)or (i3=i2) then
continue;
for i4:=1 to 8 do
begin
if ((i4=i1)or (i4=i2) or(i4=i3)) then
continue;
for i5:=1 to 8 do
begin
if (i5=i1)or(i5=i2) or(i5=i3)or(i5=i4) then
continue;
for i6:=1 to 8 do
begin
if (i6=i1)or (i6=i2) or(i6=i3) or(i6=i4) or(i6=i5) then
continue;
for i7:=1 to 8 do
begin
if (i7=i1)or (i7=i2) or(i7=i3) or(i7=i4) or(i7=i5) or(i7=i6)then
continue;
for i8:=1 to 8 do
begin
if (i8=i1)or (i8=i2) or(i8=i3) or(i8=i4) or(i8=i5) or(i8=i6) or (i8=i7)then
continue;
if ((i1*10+i2)*(i3*10+i4)=(i5*1000+i6*100+i7*10+i8)) then
begin
m:= i1*10+i2;
n:= i3*10+i4;
k:= i5*1000+i6*100+i7*10+i8;
mm:= concat(inttostr(m),',', inttostr
,',',inttostr(k));
application.MessageBox(pchar(mm),'kkkk',32);
end;
end;
end;
end;
end;
end;
end;
end;
end;
end;