c10.cpp

来自「此文件可以能帮你求体积」· C++ 代码 · 共 38 行

CPP
38
字号
// c10.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream.h>

int Infer();

int main(int argc, char* argv[])
{
	int a = Infer();
	switch(a)
	{
	case 0: cout << "丁是偷盗者!\n"; break;
	case 1: cout << "丙是偷盗者!\n"; break;
	case 2: cout << "乙是偷盗者!\n"; break;
	case 3: cout << "甲是偷盗者!\n"; break;
	default: cout << "无法判断!\n"; break;
	}

	return 0;
}

int Infer()
{
	for ( int i = 0; i < 4; i++ )
	{
		if ( !( 1==(1<<i & 5) || 4 == (1<<i & 5) ) ) continue; // A
		if ( !( 2==(1<<i & 6) || 4 == (1<<i & 6) ) ) continue; // B
		if ( !( 8==(1<<i & 12) || 4 == (1<<i & 12) ) ) continue; // C

		return i;
	}

	return -1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?