CTF-z3解数独
来源:https://ericpony.github.io/z3py-tutorial/guide-examples.htm
Sudoku
Sudoku is a very popular puzzle. The goal is to insert the numbers in the boxes to satisfy only one condition: each row, column and 3x3
box must contain the digits 1
through 9
exactly once.
The following example encodes the sudoku problem in Z3. Different sudoku instances can be solved by modifying the matrix instance
. This example makes heavy use of list comprehensions available in the Python programming language.
1 | # 9x9 matrix of integer variables |
很厉害啊
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 X Mεl0n | 随手记!