小小的人工智能问题 求解
题目:在一次会议上,A说B在说假话,B说C在说假话,C说A和B在说假话。试问谁在说假话,谁在说真话。我程序如下不知道哪出错了它好像只执行一次循环
/*判断谁在说真话谁在说假话*/
#include <stdio.h>
int main()
{
int A;
int B;
int C;
int count = 0;
for (A=0; A<2; A++)
{
for (B=0; B<2; B++)
{
for (C=0; C<2; C++)
{
count += ((A == 1 && B == 0) || (A == 0 && B ==1));
count += ((B == 1 && C == 0) || (B == 0 && C == 1));
count += ((C == 1 && A == 0 && B == 0) || (C == 0 && A == 1 && B== 1));
goto finish;
}
}
}
finish : if (count == 3)
{
printf("A is saying %s.word\n", (A == 1) ? "true" : "false");
printf("B is saying %s.word\n", (B == 1) ? "true" : "false");
printf("C is saying %s.word\n", (C == 1) ? "true" : "false");
}
return 0;
}