欢迎您访问52IJ教育培训网,今天小编为你分享的英语方面的学习知识是通过网络精心收集整理的:“020009_000 004 020009 000 000050 200 000060 000 000001 0...[英语]”,注意:所整理内容不代表本站观点,如你有补充或疑问请在正文下方的评论处发表。下面是详细内容。
7 8 6 5 1 4 3 2 9
2 4 9 3 7 6 5 8 1
1 5 3 2 8 9 4 7 6
4 6 5 1 3 7 8 9 2
8 3 1 9 5 2 6 4 7
9 2 7 6 4 8 1 5 3
5 1 4 7 9 3 2 6 8
6 9 8 4 2 1 7 3 5
3 7 2 8 6 5 9 1 4
附解题程序代码
program zk;{20:16 -22:12}
const n=9;
var
i,j,a,b,c,t,p:longint;
map:array [1..9,1..9] of longint;
hang,lie,gong:array [1..9,1..9] of boolean;
h,l,g:array [1..9] of longint;
ok:boolean;
wei:array [1..9,1..9] of longint=((1,1,1,2,2,2,3,3,3),(1,1,1,2,2,2,3,3,3),(1,1,1,2,2,2,3,3,3),(4,4,4,5,5,5,6,6,6),(4,4,4,5,5,5,6,6,6),(4,4,4,5,5,5,6,6,6),(7,7,7,8,8,8,9,9,9),(7,7,7,8,8,8,9,9,9),(7,7,7,8,8,8,9,9,9));
lin,lll:array [1..10] of longint;
procedure print;
var
a,b:longint;
begin
for a:=1 to 9 do
begin
for b:=1 to 9 do
write(map[a,b],' ');
writeln;
end;
end;
procedure sou(k,z:longint);
var
s:longint;
begin
if z=10 then begin inc(k); z:=1; end;
if (k=10) and (z=1) then begin print; ok:=true; exit; end;
if k=10 then exit;
if map[lin[k],lll[z]]=0
then
for s:=1 to 9 do
if (hang[lin[k],s]=false) and (gong[wei[lin[k],lll[z]],s]=false) and (lie[lll[z],s]=false) then
begin
map[lin[k],lll[z]]:=s;
hang[lin[k],s]:=true; lie[lll[z],s]:=true; gong[wei[lin[k],lll[z]],s]:=true;
sou(k,z+1);
if ok then exit;
hang[lin[k],s]:=false; lie[lll[z],s]:=false; gong[wei[lin[k],lll[z]],s]:=false;
map[lin[k],lll[z]]:=0;
end else
else sou(k,z+1);
end;
begin
assign(input,'sudoku.in');
assign(output,'sudoku.out');
reset(input);
rewrite(output);
readln(t);
for p:=1 to t do
begin
for i:=1 to 9 do
begin
lin[i]:=i;
lll[i]:=i;
end;
fillchar(hang,sizeof(hang),false);
fillchar(lie,sizeof(lie),false);
fillchar(gong,sizeof(gong),false);
fillchar(h,sizeof(h),0);
fillchar(l,sizeof(l),0);
fillchar(g,sizeof(g),0);
ok:=false;
for i:=1 to 9 do
begin
for j:=1 to 9 do
begin
read(map[i,j]);
if map[i,j]0 then
begin
hang[i,map[i,j]]:=true; inc(h[i]);
lie[j,map[i,j]]:=true; inc(l[j]);
gong[wei[i,j],map[i,j]]:=true; inc(g[wei[i,j]]);
end;
end;
readln;
end;
for i:=1 to n do
for j:=i to n do
if h[i]
其他类似问题
问题1:070000169000010800000807300030002008002000500600700030003603000005080000986000020[数学科目]

问题2:数独

问题3:九宫格数独答案670200010000004000000300009305040000004900058000006900240650000908000006036020007[数学科目]
用候选数法解
|679|285|314|
|823|194|675|
|451|367|289|
|395|748|162|
|164|932|758|
|782|516|943|
|247|659|831|
|918|473|526|
|536|821|497|
问题4:100000709030000020020050306470100000058000200000408000003060000000049650000001002[数学科目]
*-----------------------------------------------*
| 1 6 5| 2 3 4| 7 8 9|
| 7 3 9| 8 1 6| 5 2 4|
| 8 2 4| 9 5 7| 3 1 6|
|---------------+---------------+---------------|
| 4 7 2| 1 9 5| 8 6 3|
| 9 5 8| 6 7 3| 2 4 1|
| 3 1 6| 4 2 8| 9 7 5|
|---------------+---------------+---------------|
| 5 4 3| 7 6 2| 1 9 8|
| 2 8 1| 3 4 9| 6 5 7|
| 6 9 7| 5 8 1| 4 3 2|
*-----------------------------------------------*
问题5:070 000 060003 407 100500 809 003100 698 002009 030 500300 512 007700 906 001004 301 900690 000 030[数学科目]
如下:
472 153 869
983 467 125
516 829 473
157 698 342
269 734 518
348 512 697
735 946 281
824 371 956
691 285 734
- 偷听音乐_...有的同学甚至上课也偷听音乐,请你对
- 2011年广交会时间_...我们将参展110届秋季广交会
- 16岁生日派对_英语作文-生日PARTY要求:下周六是
- matter是什么意思_matter是什么意思那 what is th
- 砸日货_英语翻译我们要抵制日货并不是要砸自己的
- 真的爱你 苏妙玲_苏妙玲 真的爱你When you hold m
- 卓越网和亚马逊_...中国的困境研究2.亚马逊搜购卓
- trump是什么意思_排版兼英文高手请进!text set in
- 保护色_“保护色”英文怎么说[英语]
- time is money_Time Is MoneyAs the taxi came to
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
