#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std; #define FOR(i,s,t) for (int i = s; i < t; ++i)
#define MEM(s,v) memset(s, v, sizeof(s)) #define EPS 1e-8
#define _N 15
#define _M 105
#define PI acos(-1.0) int even[], light[], heavy[];
char l[_N], r[_N], b[_N]; void set_union(int *a, char *b)
{
FOR (i, , strlen(b)) { a[b[i] - 'A'] += ; }
} int main()
{
int n; scanf("%d", &n); while (n--) {
MEM (even, ); MEM (light, ); MEM (heavy, );
FOR (i, , ) {
scanf("%s%s%s", l, r, b);
if (b[] == 'e') {
set_union(even, l);
set_union(even, r);
} else if (b[] == 'u') {
set_union(heavy, l);
set_union(light, r);
} else {
set_union(light, l);
set_union(heavy, r);
}
}
int _l[], _h[];
FOR (i, , ) {
_l[i] = light[i] * (!even[i] && light[i]);
_h[i] = heavy[i] * (!even[i] && heavy[i]);
}
int max_c = , max_n = , _t = ;
FOR (i, , ) if (_l[i] > max_n) {
max_c = i; max_n = _l[i]; _t = -;
}
FOR (i, , ) if (_h[i] > max_n) {
max_c = i; max_n = _h[i]; _t = ;
}
printf("%c is the counterfeit coin and it is %s.\n", max_c + 'A', _t == - ? "light" : "heavy");
}
return ;
}

poj 1013(uva 608) Counterfeit Dollar的更多相关文章

  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. POJ 1013 Counterfeit Dollar

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

  3. POJ 1013:Counterfeit Dollar

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

  4. Counterfeit Dollar 分类: POJ 2015-06-12 15:28 19人阅读 评论(0) 收藏

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

  5. POJ1013 Counterfeit Dollar

    题目来源:http://poj.org/problem?id=1013 题目大意:有12枚硬币,其中有一枚假币.所有钱币的外表都一样,所有真币的重量都一样,假币的重量与真币不同,但我们不知道假币的重量 ...

  6. Counterfeit Dollar -----判断12枚钱币中的一个假币

     Counterfeit Dollar Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u ...

  7. poj1013.Counterfeit Dollar(枚举)

    Counterfeit Dollar Time Limit: 1 Sec  Memory Limit: 64 MB Submit: 415  Solved: 237 Description Sally ...

  8. POJ 1013 小水题 暴力模拟

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

  9. POJ 3525/UVA 1396 Most Distant Point from the Sea(二分+半平面交)

    Description The main land of Japan called Honshu is an island surrounded by the sea. In such an isla ...

随机推荐

  1. hrbustoj 2033 A Funny Game(对称博弈)

    对称博弈,注释在代码里 #include<iostream> #include<cstdio> using namespace std; ///这个地方其实是博弈原理里面的对称 ...

  2. 关于JSON.parse在ie6,ie7下未定义的issue

    情况是这样的: 在ie6下出现一个js error,说是JSON.parse为定义,一查,才知道,ie6,ie7不支持JSON. solution:只要在使用JSON之前加载个json2.js就行了. ...

  3. Eclipse使用的小细节归档

    1. 控制台打印出来的语句不限制条数:Preference-> Run/Debug -> Control -> Limit Console Output 2.

  4. phantom" breakpoints

    http://stackoverflow.com/questions/723199/why-does-my-eclipse-project-have-phantom-debugger-breakpoi ...

  5. sdf SimpleDateFormat 不是线程安全的,

    我经常用一个public static SimpleDateFormat sdf; 今天发现报“java.lang.NumberFormatException: multiple points”的异常 ...

  6. 在js中如何得到上传文件的大小。

    <html>  <head>  <script language="javascript">    function getSize() {   ...

  7. FMDB增删查改

    创建,插入,更新和删除:使用executeUpdate方法,而查询则用executeQuery 1.实例化FMDatabase //paths: ios下Document路径,Document为ios ...

  8. 微信小程序实例教程(二)

    第五章:微信小程序名片夹详情页开发 今天加了新干货!除了开发日志本身,还回答了一些朋友的问题. 闲话不多说,先看下「名片盒」详情页的效果图: 备注下大致需求:顶部背后是轮播图,二维码按钮弹出模态框信息 ...

  9. MySQL的 explain 解析

    EXPLAIN 的每个输出行提供一个表的相关信息,并且每个行包括下面的列: 项 说明 id MySQL Query Optimizer 选定的执行计划中查询的序列号.表示查询中执行 select 子句 ...

  10. iOS平台软件开发工具(一)-新建的工程使用CocoaPods工具集成第三方框架

    CocoaPods是一款集合了上千个第三方开源库的开发工具,能够大幅度的提升团队项目的开发效率,降低时间成本. 那么就看一下CocoaPods这个工具在项目中的使用体现吧. 我们马上用ASIHTTPR ...