⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 poan.cpp

📁 高质量C中的关于解决破案问题的
💻 CPP
字号:
// poan.cpp : Defines the entry point for the console application.
//用数理逻辑来正规表达式表示1.a->b,

#include "stdafx.h"
#include<stdio.h>
int main(void)
{
	int count=0;
	int sum=0;
	int a,b,c,d,e;
	for(a=0;a<2;a++){
		for(b=0;b<2;b++){
			for(c=0;c<2;c++){
				for(d=0;d<2;d++){
					for(e=0;e<2;e++)
					{
					sum=0;
					sum+=(a==0||(a==1&&b==1))?1:0;
					sum+=((b+c)==1)?1:0;
					sum+=(c==d)?1:0;
					sum+=((d+e)>=1)?1:0;
					sum+=(e==0||(e==1&&a==1&&d==1))?1:0;
					if(sum==5 )
					{
						count++;
						printf("// this is the %d th answer:\n",count);
						printf("suspect a is %s.\n",(a==1)?"a criminal":"not a criminal");
						printf("suspect b is %s.\n",(b==1)?"a criminal":"not a criminal");
					    printf("suspect c is %s.\n",(c==1)?"a criminal":"not a criminal");
					    printf("suspect d is %s.\n",(d==1)?"a criminal":"not a criminal");
						printf("suspect e is %s.\n",(e==1)?"a criminal":"not a criminal");
						printf("\n");
					}
					
				
					}
				}
			}
		}
	}
return 0;


}

⌨️ 快捷键说明

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