#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. 直接拿来用!最火的iOS开源项目(一)

    直接拿来用!最火的iOS开源项目(一) 发表于2013-06-05 10:17| 39373次阅读| 来源CSDN| 100 条评论| 作者唐小引 iOS开源项目GitHub移动开发最受欢迎的开源项目 ...

  2. hrbustoj 1985(进制转换函数)

    这个水题当然没有好说的,主要是介绍一个很牛掰的函数 strtol(b,NULL,k)这个函数可以直接把字符串b转化为k进制的数 #include<stdio.h> #include< ...

  3. 三列布局,读《css那些事儿》

    1.两列定宽,中间自适应 要点:浮动.负边距效果.mainbox增加内容div并设置margin.:after清除浮动 原理:mainbox的浮动并将其宽度设置为100%,次要内容及侧边栏设置固定宽度 ...

  4. 可用类型的几何对象esriGeometryType Constants

    The available kinds of geometry objects. Constant Value Description esriGeometryNull 0 A geometry of ...

  5. ural1470 UFOs

    UFOs Time limit: 2.0 secondMemory limit: 64 MB Vasya is a ufologist and his duties include observing ...

  6. Fruit Feast

    Fruit Feast 题目描述 Bessie has broken into Farmer John's house again! She has discovered a pile of lemo ...

  7. Android开发学习资源

    https://developer.android.google.cn/training/index.html

  8. A tutorial that will show you how to build an instant messaging app with Sinch.

    http://stackoverflow.com/questions/26247986/unsatisfiedlinkerror-couldnt-load-sinch-android-rtc-from ...

  9. FreeRTOS代码剖析

    FreeRTOS代码剖析之1:内存管理Heap_1.c   FreeRTOS代码剖析之2:内存管理Heap_2.c   FreeRTOS(V8.0.1)系统之xTaskGenericCreate() ...

  10. [Unity AssetBundle]Asset资源处理

    什么是AssetBundle 在很多类型游戏的制作过程中,开发者都会考虑一个非常重要的问题,即如何在游戏运行过程中对资源进行动态的下载和加载.因此,Unity引擎引入了AssetBundle这一技术来 ...