为什么连个输出都没有

P1618 三连击(升级版)

Rand0w @ 2016-12-03 20:02:35

var
i,j,m,n,a1,a2,a3:longint;
iarr:array[1..3] of integer;
book:array[1..10] of boolean;
arr:array[1..10] of integer;
procedure dfs(m : integer);
begin
if m =9 then
begin
for j:=1 to 3 do
begin
iarr[i]:= arr[i]*100+arr[i+1]*10+arr[i+2];
end;
if ((iarr[1]/a1)=(iarr[2]/a2)) and  ((iarr[3]/a3)=(iarr[2]/a2)) then
begin
write(iarr[1]);
write(' ');
write(iarr[2]);
write(' ');
write(iarr[3]);
writeln;
exit();
end;
for i := 1 to 9 do
begin
if not(book[i]) then
begin
book[i]:= true;
arr[m]:=i;
dfs(m+1);
book[i]:=false;
end;
exit();
end;
end;
end;
begin
readln(a1,a2,a3);
dfs(1);
end.

by nonanalyzer @ 2017-01-29 20:26:34

好像有一种情况叫做“无解”


by nonanalyzer @ 2017-01-29 20:27:05

你再仔细读几遍题目吧


|