我编了个程序解数独题,试了很多题都能解出来,但碰到一道题解不了,好像是内存耗用太多之类的原因,其实感觉不应该会计算太多的。我想问下有没有人用go写过啊?帮解下这道题,如果能解出来,那就是我的代码有问题了,到时贴代码出来给大家看看。
000700001
900000628
602000590
000081005
070503000
090060070
000005000
200040086
040030000
0代表需要空白。
其实很怪,我将第一个填上5,马上就能解出来。
希望哪位帮解下。
`我用C语言写的解得挺快的(go正在学习中)。我接的结果是这样,需要的话我可以把代码贴出来:`
RESULT SUDOKU
`*****************************************************`
`+-----------------+-----------------+-----------------+`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 5 | 8 | 7 | | | 9 | 2 | 6 | | | 4 | 3 | 1 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 9 | 1 | 4 | | | 3 | 5 | 7 | | | 6 | 2 | 8 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 6 | 3 | 2 | | | 8 | 1 | 4 | | | 5 | 9 | 7 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`+-----------------+-----------------+-----------------+`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 3 | 2 | 6 | | | 7 | 8 | 1 | | | 9 | 4 | 5 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 4 | 7 | 8 | | | 5 | 9 | 3 | | | 1 | 6 | 2 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 1 | 9 | 5 | | | 4 | 6 | 2 | | | 8 | 7 | 3 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`+-----------------+-----------------+-----------------+`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 8 | 6 | 9 | | | 2 | 7 | 5 | | | 3 | 1 | 4 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 2 | 5 | 3 | | | 1 | 4 | 9 | | | 7 | 8 | 6 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`| | 7 | 4 | 1 | | | 6 | 3 | 8 | | | 2 | 5 | 9 | |`
`| --- --- --- | --- --- --- | --- --- --- |`
`+-----------------+-----------------+-----------------+`
*****************************************************
GAME OVER
`(本来在输出的格式还挺整齐的,粘到这里好像变形了)`
#8
更多评论
不好意思,写错了,应该是下面的
007000001
900000628
602000590
000081005
070503000
090060070
000005000
200040086
040030000
#2