这段时间一直再看组合算法,其程序是用pascal写的,我转换成VC之后,怎么都运行不了,麻烦大家帮我看看,谢谢了。
以下是pascal程序:
Procedure make(lev:byte);
Var I,j,t:integer;
Lltype,ltype:整型数组;
Begin
For i:=1 to n do
For j:=1 to m do
If b[i,j]=1 then
Begin
For t:=1 to n do if b[t,j]=1 then b[t,j]:=-lev;
For t:=1 to n do if b[i,t]=1 then b[t,j]:=-lev;
Make(lev+1);
Lltype=ltype;
For t:=1 to n do if b[t,j]= -lev then b[t,j]:=1;
For t:=1 to n do if b[i,t]= -lev then b[t,j]:=1;
b[i,j]= -lev;
make(lev+1);
for t:=s downto 1 do ltype[t]=ltype[t]+lltype[t];
exit;
end;
fillchar(l,sizeof(l),0); l[0]:=1;
end;
void make(int lev)
{
int i,j,t;
int lltype[10];
for(t=0;t<10;t++)
{
ltype[t]=0;
lltype[t]=0;
}
for(j=0;j<N2;j++)
if(chess1[i][j]=='1')
{
for(t=i;t<N1;t++)
if(chess1[t][j]=='1')
chess1[t][j]='3';
if(chess1[i][t]=='1')
chess1[i][t]='3';
for(int tt=0;tt<min;tt++)
lltype[tt]=ltype[tt];
if(chess1[t][j]=='3')
chess1[t][j]='1';
if(chess1[i][t]=='3')
chess1[i][t]='1';
make(lev+1);
{
ltype[t]=ltype[t]+lltype[t-1];
}
}
else ltype[0]=1;
}
[此贴子已经被作者于2006-12-22 22:17:21编辑过]