[ABC189D] Logical Expression
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
AT_abc189_d [ABC189D] Logical Expression
题目描述
给定 个字符串 ,每个字符串为 AND 或 OR。
请计算有多少组 个变量 ,每个变量的取值为 或 ,使得按照如下方式计算后, 的值为 。
- 当 时,若 为
AND,则 ;若 为OR,则
其中 表示 与 的逻辑与, 表示 与 的逻辑或。
输入格式
输入以如下格式从标准输入读入:
输出格式
请输出答案。
输入输出样例 #1
输入 #1
2
AND
OR
输出 #1
5
输入输出样例 #2
输入 #2
5
OR
OR
OR
OR
OR
输出 #2
63
说明/提示
限制条件
- 为
AND或OR
样例解释 1
例如,当 $(x_0,x_1,x_2)=(\text{True},\text{False},\text{True})$ 时:
- $y_1 = y_0 \land x_1 = \text{True} \land \text{False} = \text{False}$
- $y_2 = y_1 \lor x_2 = \text{False} \lor \text{True} = \text{True}$
因此 的值为 。
使 为 的 的组合共有:
共 种。
样例解释 2
除了所有变量均为 的情况外,其余 种组合都能使 为 。
由 ChatGPT 4.1 翻译
251129测试
- Status
- Done
- Rule
- OI
- Problem
- 7
- Start at
- 2025-12-6 14:00
- End at
- 2025-12-6 17:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 16