谁是作案嫌疑人?

Time Limit: 1000 ms Memory Limit: 65536 KiB

Problem Description

刑侦大队对涉及六个嫌疑人的一桩疑案进行分析:
一、a ,b至少有一人作案;
二、a,e,f三人中至少有两人参与作案;
三、 a ,d不可能是同案犯;
四、b,c或同时作案,或与本案无关;
五 c,d中有且只有一人作案;
六 如果d没有参与作案则e也不可能参与作案。
试编写程序,寻找作案人。

Input

多组测试数据,对于每组测试数据,第 1 行输入 6 个空格分隔的整数,代表a、b、c 、d 、e 、f的编号,编号x范围(1 <= x <= 6),且编号互不相同。

Output

对于每组测试数据,第 1 行至第 6 行分别输出对 a、b、c 、d 、e 、f的判断,详细输出格式请参考样例。

Sample Input

1 2 3 4 5 6

Sample Output

The suspects numbered 1 are criminals.
The suspects numbered 2 are criminals.
The suspects numbered 3 are criminals.
The suspect numbered 4 is not a criminal.
The suspect numbered 5 is not a criminal.
The suspects numbered 6 are criminals.
#include <stdio.h>
#include <stdlib.h> int main()
{
int a,b,c,d,e,f,a1,a2,a3,a4,a5,a6;
while(~scanf("%d %d %d %d %d %d",&a1,&a2,&a3,&a4,&a5,&a6))
{
int count=0;
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
{
for(c=0;c<=1;c++)
{
for(d=0;d<=1;d++)
{
for(e=0;e<=1;e++)
{
for(f=0;f<=1;f++)
{
if(a==1||b==1)count++;
if((a==1&&e==1)||(a==1&&f==1)||(e==1&&f==1))count++;
if(!(a==1&&d==1))count++;
if((b==1&&c==1)||(b==0&&c==0))count++;
if((c==0&&d==1)||(c==1&&d==0))count++;
if(d==1||(d==0&&e==0))count++;
if(count==6)
{
printf("The suspects numbered %d are criminals.\n",a1);
printf("The suspects numbered %d are criminals.\n",a2);
printf("The suspects numbered %d are criminals.\n",a3);
printf("The suspect numbered %d is not a criminal.\n",a4);
printf("The suspect numbered %d is not a criminal.\n",a5);
printf("The suspects numbered %d are criminals.\n",a6);
}
}
}
}
}
}
} }
return 0;
}

看着就头疼;

【离散数学】 SDUT OJ 谁是作案嫌疑人?的更多相关文章

  1. SDUT OJ 2607

    /*http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2607*/ 题目大意:给出一个字符串,求出里 ...

  2. SDUT OJ 1221 亲和数 (找出某个数n所有的因子数,只需要暴力:2->sqrt(n) 即可 )

    亲和数 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 如果a的因子和等于b,b的因子和等于a,且a≠b,则称a,b为亲和数对. ...

  3. SDUT OJ 图练习-BFS-从起点到目标点的最短步数 (vector二维数组模拟邻接表+bfs , *【模板】 )

    图练习-BFS-从起点到目标点的最短步数 Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 在古老的魔兽传说中,有两个军团,一个叫天 ...

  4. 【离散数学】 SDUT OJ 传递闭包 && memset 使用注意事项

    传递闭包 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 已知有n头牛,m次战斗关系, ...

  5. 【离散数学】 SDUT OJ 建图

    建图 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 编程使得程序可以接受一个图的点边 ...

  6. 【离散数学】SDUT OJ 指定长度路径数

    指定长度路径数 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 题目给出一个有n个节点 ...

  7. 【离散数学】SDUT OJ 补图

    补图 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 题目给出一个无向图,求该无向图关 ...

  8. 【离散数学】 SDUT OJ 偏序关系

    偏序关系 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 给定有限集上二元关系的关系矩 ...

  9. 【离散数学】 SDUT OJ 集合的包含

    集合的包含 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description 已知含n个元素的集合的子集 ...

随机推荐

  1. Codeforces Round #499 (Div. 2)(1011)

    Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide fo ...

  2. Vulkan Tutorial 04 理解Validation layers

    操作系统:Windows8.1 显卡:Nivida GTX965M 开发工具:Visual Studio 2017 What are validation layers? Vulkan API的设计核 ...

  3. SonarQube在CentOS上的安装

    1 简介 SonarQube 是一个用于代码质量管理的开放平台.通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具.与持续集成工具(例如 Hudson/Jenkins 等 ...

  4. collections、time和datetime模块

    主要内容: 一.collections模块 二.time模块 三.datetime模块 1️⃣  collection模块 1.什么是collections模块.干什么用? collections模块 ...

  5. logback-spring.xml的schema

    <?xml version="1.0" encoding="utf-8" ?> <configuration xmlns:xsi=" ...

  6. 为cscope查找列表增添色彩

    我在使用cscope的时候,偏好于不用quickfix窗口来显示查找列表,而是选择类似ctag的列表.但这会带来一个比较麻烦的问题,就是窗口列表一片白色,看起来非常难受: 特别是当搜索结果特别多的时候 ...

  7. 在页面完成读取EXCEL

    protected void btnUpload_Click(object sender, EventArgs e) { if (Page.IsValid) { string sFILENAME = ...

  8. Memcached 原理

    memcached  是以一个守护进程的方式运行于一个服务器和多个服务器之间的,等待接受客户端的连接操作,客户端可以有各种语言编写.(例如PHP). php 在客户端与服务器建立连接以后,接下来的事情 ...

  9. 136. Single Number唯一的一个只出现了一次的数字

    [抄题]: Given a non-empty array of integers, every element appears twice except for one. Find that sin ...

  10. jQuery--左侧菜单收缩隐藏

    实现步骤: 步骤一. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...