#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
int r=1,s=1,t[2]={1,1},p2=1;
bool AND(int a,int b)
{
if(a&&b)
return true;
return false;
}
bool Solve_OR(int a,int b)
{
if(a==0)
return b;
if(b==0)
return a;
if(a==1||b==1)
return true;
if(a==0&&b==0)
return false;
}
int main()
{
t[1]=0;//假设后件为假
bool f1,f2,f3,f4;
//模拟析取公式化简过程
f1=Solve_OR(t[1],t[2]);
f2=Solve_OR(!t[1],!s);
f3=Solve_OR(!p2,r);
f4=Solve_OR(p2,s);
bool ans=AND(!r,AND(f1,AND(f2,AND(f3,f4))));
printf("f1:%d f2:%d f3:%d f4:%d\n",f1,f2,f3,f4);
printf("ta:%d tb:%d p2:%d r:%d s:%d !r:%d !s:%d\n",t[1],t[2],p2,r,s,!r,!s);
printf("ANS:%d\n",ans);//输出前件的真值
return 0;
}
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
bool AND(int a,int b)
{
if(a&&b)
return true;
return false;
}
bool OR(int a,int b)
{
if(a||b)
return true;
return false;
}
int main()
{
int f1,f2,f3,f4,ans;
for(int ta=0;ta<=1;ta++)
for(int tb=0;tb<=1;tb++)
for(int pb=0;pb<=1;pb++)
for(int s=0;s<=1;s++)
for(int r=0;r<=1;r++)
{
f1=OR(ta,tb);
f2=OR(!ta,!s);
f3=OR(!pb,r);
f4=OR(pb,s);
ans=AND(!r,AND(f1,AND(f2,AND(f3,f4))));
if(ans)
printf("A:%d B:%d\n",ta,tb);
}
return 0;
}
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
bool AND(int a,int b)
{
if(a&&b)
return true;
return false;
}
bool OR(int a,int b)
{
if(a||b)
return true;
return false;
}
int main()
{
int f1,f2,f3,f4,f5,flag=1,ans;
for(int ta=0;ta<=1;ta++)
for(int tb=0;tb<=1;tb++)
for(int pb=0;pb<=1;pb++)
for(int s=0;s<=1;s++)
for(int r=0;r<=1;r++)
{
f1=OR(ta,tb);
f2=OR(!ta,!s);
f3=OR(!pb,r);
f4=OR(pb,s);
f5=AND(!r,AND(f1,AND(f2,AND(f3,f4))));
ans=OR(!f5,ta);
if(!ans)
flag=0;
}
printf("%d\n",flag);//若结果为0,则式子并非永真蕴含式,对于A盗窃的推理错误,故为B盗窃
return 0;
}