catik 2015-04-12 02:29 采纳率: 0%
浏览 1202

永真式的判定程序(c++)

Description
Check if a proposition in postfix form is a tautology, for example, pp~+ (that is, p\/~p) is a tautology, while qq~*r+ (q/~q)\/r is not.

Input
The first line is an integer N(<=1000).

Then there are N lines of propositional formulas with postfix form, where '~' represents negation, '*' represents conjunction and '+' represents disjunction. Propositional variables are lower case letters.

Output
For each formula, output the formula, then a colon ':' and "Yes" or "No" on one line depending on if the formula is a tautoloty.

Sample Input
Copy sample input to clipboard
4
p
pq~p~**~
pq+
p~p+
Sample Output
p:No
pq~p~**~:Yes
pq+:No
p~p+:Yes

这是我的代码,但是不知道哪里出问题了,谁能帮看一下
http://soj.sysu.edu.cn/viewsource.php?cid=971&sid=2337569

  • 写回答

1条回答 默认 最新

  • 微软技术分享 优质创作者: 编程框架技术领域 2024-03-08 15:01
    关注

    你的链接失效了,重新发一下吧。

    评论

报告相同问题?