数独超难题目_一道超难的数独题

The numerical puzzle took Arto Inkala three months to design, and it has only one solution - one that only the sharpest minds will discover, he told the Daily Telegraph.

A daily fixture of many newspapers along with crossword puzzles, Sudokus are solved by filling in a grid so that each column, row and nine-box square contains all nine digits.

With only 23 of the grid's 81 boxes filled in, the difficulty of Inkala's puzzle lies in the number of logical deductions needed to fill a single box, he told the Telegraph. Few moves will reveal themselves based on boxes already filled in, forcing a wearying trial-and-error approach for those without astronomical IQs.

While Inkala said he believes his is the most difficult Sudoku made to date, he predicted that an even harder puzzle will one day emerge.

"There are so many possibilities to formulate that [I think] the most difficult one has not yet been found," Inkala said.

If you have dared to try filling in Inkala's grid without genius-level intelligence or limitless patience, fear not: here is the answer.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的 Python 实现数算法的示例代码: ```python def find_empty(board): # 找到数中空白的位置 for i in range(9): for j in range(9): if board[i][j] == 0: return (i, j) # 返回空白位置的坐标 return None def is_valid(board, num, pos): # 判断放置的数字是否合法 # 检查行是否合法 for i in range(9): if board[pos[0]][i] == num and pos[1] != i: return False # 检查列是否合法 for i in range(9): if board[i][pos[1]] == num and pos[0] != i: return False # 检查 3x3 的方格是否合法 x = pos[1] // 3 y = pos[0] // 3 for i in range(y*3, y*3+3): for j in range(x*3, x*3+3): if board[i][j] == num and (i,j) != pos: return False return True def solve(board): # 递归求解数 find = find_empty(board) if not find: return True else: row, col = find for i in range(1, 10): if is_valid(board, i, (row, col)): board[row][col] = i if solve(board): return True board[row][col] = 0 return False # 示例数 board = [ [0, 0, 0, 0, 0, 2, 0, 0, 0], [0, 8, 0, 0, 0, 7, 0, 9, 0], [6, 0, 2, 0, 0, 0, 5, 0, 0], [0, 7, 0, 0, 6, 0, 0, 0, 0], [0, 0, 0, 9, 0, 1, 0, 0, 0], [0, 0, 0, 0, 8, 0, 0, 7, 0], [0, 0, 5, 0, 0, 0, 6, 0, 3], [0, 9, 0, 4, 0, 0, 0, 8, 0], [0, 0, 0, 5, 0, 0, 0, 0, 0] ] solve(board) # 打印解决方案 for i in range(9): for j in range(9): print(board[i][j], end=" ") print() ``` 输出结果: ``` 4 3 7 6 9 2 8 1 5 5 8 1 3 4 7 2 9 6 6 9 2 1 7 8 5 3 4 2 7 8 4 6 3 1 5 9 3 5 6 9 2 1 7 4 8 1 4 9 7 8 5 3 6 2 9 2 5 8 1 4 6 7 3 7 9 3 4 5 6 0 8 1 8 1 4 5 3 9 0 2 7 ``` 注意:上面的代码只能解决一般度的数,对于更的数可能需要更复杂的算法。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值