讨论 / 看看这个程序哪里有问题,问什么50分
wjzzm 2010-10-29 18:30:00
点我顶贴 收藏 删除
program s1;

var a:array[1..200,1..200]of integer;

b:array[1..200]of boolean;

n,i,j,k,l,o,p:longint;

ss,ss2:set of 0..200;

z1,z2:boolean;

procedure try(x,y:integer);

var j,k:integer;

begin

if x=y then

begin

if z2=true then

begin

ss2:=ss;

z2:=false;

end

else ss2:=ss*ss2;

end

else

for j:=1 to n do

if (a[x,j]=1) and (b[j]) then

begin

b[j]:=false;

ss:=ss+[j];

try(j,y);

ss:=ss-[j];

b[j]:=true;

end;

end;

begin

assign(input,'1.in');

reset(input);

readln(n,p);

for i:=1 to n do

for j:=1 to n do

read(a[i,j]);

for i:=1 to n do

if i<>p then

begin

fillchar(b,sizeof(b),true);

ss:=[];

ss2:=[];

z1:=true;z2:=true;

b[p]:=false;

try(p,i);

ss2:=ss2-[i];

for j:=1 to n do

if j in ss2 then

begin

write(j,' ');

z1:=false;

end;

if z1=true then write('No');

writeln;

end;

end.

rt、、、、

查看更多回复
提交回复