#include"string.h"
char left[3][7],right[3][7],result[3][5];
bool isHeavy(char x )
{
    int i;
    for(i=0;i<3;i++)
    {
        switch(result[i][0])
        {
        case 'u':if(strchr(left[i],x)==NULL)return false;break;
        case 'e':if(strchr(left[i],x)!=NULL||strchr(right[i],x)!=NULL)return false;break;
        case 'd':if(strchr(right[i],x)==NULL)return false;break;
        }
    }
    return true;  //
}
bool isLight(char x )
{
    int i;
    for(i=0;i<3;i++)
    {
        switch(result[i][0])
        {
        case 'u':if(strchr(right[i],x)==NULL)return false;break;
        case 'e':if(strchr(left[i],x)!=NULL||strchr(right[i],x)!=NULL)return false;break;
        case 'd':if(strchr(left[i],x)==NULL)return false;break;
        }
    }
    return true; //
}
int main()
{
    int n;
    char c;        
    int i;
    scanf("%d",&n);
    while(n>0)
    {
        for( i=0;i<3;i++)
            scanf("%s%s%s",left[i],right[i],result[i]);
        for(c='A';c<='L';c++)
        {
            if(isLight(c))
            {
                printf("%c is the counterfeit coin and it is light.\n",c);
                break;
            }
            if(isHeavy(c))
            {
                printf("%c is the counterfeit coin and it is heavy.\n",c);
                break;
            }
        }
        n--;
    }
    return 0;
}

关注我的公众号,当然,如果你对Java, Scala, Python等技术经验,以及编程日记,感兴趣的话。

技术网站地址: vmfor.com

POJ 1013的更多相关文章

  1. Poj 1013 Counterfeit Dollar / OpenJudge 1013(2692) 假币问题

    1.链接地址: http://poj.org/problem?id=1013 http://bailian.openjudge.cn/practice/2692 http://bailian.open ...

  2. 模拟,找次品硬币,Counterfeit Dollar(POJ 1013)

    题目链接:http://poj.org/problem?id=1013 解题报告: 1.由于次品的重量不清楚,用time['L'+1]来记录各个字母被怀疑的次数.为负数则轻,为正数则重. 2.用zer ...

  3. POJ 1013 Counterfeit Dollar

    Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 36206   Accepted: 11 ...

  4. POJ 1013 Counterfeit Dollar 集合上的位运算

    Description Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are t ...

  5. POJ 1013 小水题 暴力模拟

    Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35774   Accepted: 11 ...

  6. poj 1013(uva 608) Counterfeit Dollar

    #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #in ...

  7. POJ 1013:Counterfeit Dollar

    Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 42028   Accepted: 13 ...

  8. 思维+模拟--POJ 1013 Counterfeit Dollar

    Sally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver d ...

  9. POJ1013 称硬币

    题目链接:http://poj.org/problem?id=1013 题目大意 有12枚硬币.其中有11枚真币和1枚假币.假币和真币重量不同,但不知道假币比真币轻还是重.现在,用一架天平称了这些币三 ...

随机推荐

  1. linux tty设置详解

    http://blog.csdn.net/againyuan/article/details/3905380 linux串口termios NAME termios, tcgetattr, tcset ...

  2. ORACLE实用函数之一 ratio_to_report的简单使用

    应用场景: 查询学生成绩级别(ABCDE)个人数和所占百分比(案列简单,勿喷). 表结构: create or replace table stu_grade( id varchar2(36), le ...

  3. 2018.08.20 bzoj1143: [CTSC2008]祭祀river(最长反链)

    传送门 一道简单的求最长反链. 反链简单来说就是一个点集,里面任选两个点u,v都保证从u出发到不了v且v出发到不了u. 链简单来说就是一个点集,里面任选两个点u,v都保证从u出发可以到达v或者v出发可 ...

  4. Intelj IDEA的pom.xml显示错误can not reconnect

    从GitHub上边down下来的开源项目,报错莫名其妙,后来发现是跟本地hosts文件有关系 hosts文件加上 127.0.0.1 localhost 然后pom文件reload一下就

  5. 第二届普适计算和信号处理及应用国际会议论文2016年 The 2nd Conference on Pervasive Computing, Signal Processing and Applications(PCSPA, 2016)

    A New Method for Mutual Coupling Correction of Array Output Signal 一种阵列输出信号互耦校正的新方法 Research of Robu ...

  6. systemtap安装

    一.systemtap介绍 SystemTap是一个强大的调试工具,是监控和跟踪运行中的Linux 内核的操作的动态方法,确切的说应该是一门调试语言,因为它有自己的语法,也有解析.编译.运行等过程(准 ...

  7. OpenGL中的旋转是可以叠加的?

    OpenGL中的旋转是可以叠加的? 1. opengl中的旋转 如:glrogtate(45.0f, 0, 0, 1),是将当前坐标系顺时针旋转45度,然后绘制, 程序如下: ; float line ...

  8. C++中的关键字用法--- 四种强制类型转换的总结

    四种强制类型转换的总结(const_cast.static_cast.dynamic_cast.reinterpreter_cast 1. C风格的强制类型转换(Type Cast)很简单,不管什么类 ...

  9. ploymer

      developer guide 接下来看声明属性 声明属性 声明属性时,可设定的参数 type:属性反序列化 value:[function(){}],配置属性默认值 readonly refle ...

  10. eclipse 安装

    做一个项目,需要搭建环境.使用sql server 2005,tomcat,eclipse.过程真复杂,碰到些小问题,不过都解决了,还算顺利. win7下sql server 2005安装:http: ...