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

永真式的判定程序(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
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥40 微信小程序 使用vant组件ActionSheet 下拉面板,内容区域滚动会触发。scroll-view自定义下拉刷!即使设置停止下拉刷新也不行。
  • ¥15 专业问题提问,7月5号2点之前
  • ¥25 使用cube ai 导入onnx模型时报错
  • ¥15 关于#微信小程序#的问题:用一个网页显示所有关联的微信小程序数据,包括每个小程序的用户访问量
  • ¥15 root的安卓12系统上,如何使apk获得root或者高级别的系统权限?
  • ¥20 关于#matlab#的问题:如果用MATLAB函数delayseq可以对分数延时,但是延时后波形较原波形有幅度上的改变
  • ¥15 使用华为ENSP软件模拟实现该实验拓扑
  • ¥15 通过程序读取主板上报税口的数据
  • ¥15 matlab修改为并行
  • ¥15 尝试访问%1服务的windows注册表时遇到问题。必须先解决此问题,然后才能运行安装过程。(请确认您正在使用管理员权限运行)373