(百例编程)50.谁在说谎

题目:张三说李四在说谎,李四说王五在说谎,王五说张三和李四都在说谎。现在问:这三人中到底谁说的是真话,谁说的是假话?

//题目:张三说李四在说谎,李四说王五在说谎,王五说张三和李四都在说谎。
//现在问:这三人中到底谁说的是真话,谁说的是假话?
//BY as1138 2011-04-02

#include 
using namespace std;

int main(void)
{
	int a,b,c;
	bool tem = false;

	for(a = 1; a >= 0;--a)
	for(b = 1; b >= 0;--b)
	for(c = 1; c >= 0;--c)
    if ((a+b==1)&&(b+c==1)&&(a+b+c==1))
    {
		cout<<"张三"<<(a?"没说谎":"说谎")<


你可能感兴趣的:(经典百题)