[問題] 兩題prolog?消失
第一次學這東西有點頭痛Orz...
懇請幫忙!
1. Write a prolog program that tests if a Boolean formula expressed in terms is
satisfiable.
In other words satisfiable (Booleanterm) is true if there is an assignment
(true or false) to each of the variables in Boolean term that render it
satisfiable (that is true).
Boolean term can contain embedded terms like:
and(X,Y), or(X,Y), not(X)
In other words you have to produce the clauses like:
satisfiable (and(X,Y)):- ...
satisfiable (or(X,Y)) :- ...
satisfiable (not(Z)) :- ...
2. Write a Prolog program that recognizes if a string made of left and right
parentheses is "well balanced" (as shown in the following examples):
"()" --> true
"())" --> false
"((()" --> false
"()()" --> true
"(()())()" --> true
"()()(" --> false
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 151.181.36.100
※ 文章網址: https://www.ptt.cc/bbs/Programming/M.1522344473.A.B43.html
噓
03/30 05:41, , 1F
03/30 05:41, 1F
→
03/30 06:14, , 2F
03/30 06:14, 2F
→
03/30 11:54, , 3F
03/30 11:54, 3F
→
03/30 11:54, , 4F
03/30 11:54, 4F
Programming 近期熱門文章
PTT數位生活區 即時熱門文章