资源说明:#include
void main()
{
int k,J,p,m,s,io,t,i,u;
k=1;
int n[4]={3,4,3,3};
int q[5][4]={{0,0,0,0},{30,31,29,28},{34,34,35,35},{38,37,38,37},{0,40,0,0}};
int nn[4],q1[14],no[14][4],q2[14];
for(t=0;t<14;t++)
for(i=0;i<4;i++)no[t][i]=0;
while(k<=4){
if(k==1){
nn[k-1]=n[k-1];
J=0;
do{
q1[J]=q[J][k-1];
no[J][k-1]=J;
J++;
}while(J<=n[k-1]);}
else{
m=nn[k-2];
nn[k-1]=m+n[k-1];
J=0;
while(J<=nn[k-1]){
int y=1000;
int i=0;
loop: if(J-i>m){i++;
if(i>n[k-1]){q2[J]=y;no[J][k-1]=io;}
else goto loop;}
else if(i>J) {q2[J]=y;no[J][k-1]=io;}
else {s=q[i][k-1]+q1[J-i];
if(sn[k-1]){q2[J]=y;no[J][k-1]=io;}
else goto loop; }
J++;}
for(i=0;i=0){p=J;
k=4;
while(k>=1){no[J][k-1]=no[p][k-1];
p=p-no[p][k-1];
k--;}
J--;
}
printf("J\\NO 1# 2# 3# 4# Q\n");
for(t=0;t<14;t++)
printf("%2d %d %d %d %d %d\n",t,no[t][0],no[t][1],no[t][2],no[t][3],q2[t]);
}
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。