
输入样例
( V | V ) & F & ( F| V)
!V | V & V & !F & (F | V ) & (!F | F | !V & V)
(F&F|V|!V&!F&!(F|F&V))
输出样例
Expression 1: F
Expression 2: V
Expression 3: V
大意就是bool类型和逻辑运算的综合运用
卡在 !!! 上很久 = = ,其他地方还是挺好写的。
AC代码
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
int stat, len;
int expression(char s[]);
int term(char s[]);
int main(){
char s[11000]; int cnt = 0; /
while(gets(s)&&strlen(s)){ tot = 0;
++cnt; stat = 0, len = strlen(s);
if(expression(s)) printf("Expression %d: V\n", cnt);
else printf("Expression %d: F\n", cnt);
}
return 0;
}

这篇博客探讨了布尔类型变量以及在编程中的逻辑运算运用,包括输入和输出样例的处理,作者在某个特定点遇到困难,但最终解决了问题。
最低0.47元/天 解锁文章
1284

被折叠的 条评论
为什么被折叠?



