时间:2024-01-26 15:20:02 | 来源:网站运营
时间:2024-01-26 15:20:02 来源:网站运营
一道逻辑题,2015阿里校招,下面哪个选项是对的?:这个用Prolog不就完了:- use_module(library(clpfd)).puzzle(Puzzle) :- Puzzle = [A,B,C,D,E,F], Puzzle ins 0..1, A+B+C+D+E+F #= 1, A #<==> (A+B+C+D+E+F #= 0), B #<==> (A+B+C+D+E+F #> 1), C #<==> (D+E #= 0), D #<==> (B+C #> 0), E #<==> (C #= 0), F #<==> (E+F #> 0), label(Puzzle).
?- puzzle(P).false.
关键词:逻辑