HDU 6213 Chinese Zodiac 【模拟/水题/生肖】
Victoria is married to a younger man, but no one knows the real age difference between the couple. The good news is that she told us their Chinese Zodiac signs. Their years of birth in luner calendar is not the same. Here we can guess a very rough estimate of the minimum age difference between them.
If, for instance, the signs of Victoria and her husband are ox and rabbit respectively, the estimate should be 2
years. But if the signs of the couple is the same, the answer should be 12
years.
indicating the number of test cases.
For each test case a line of two strings describes the signs of Victoria and her husband.
ox rooster
rooster ox
dragon dragon
4
12
【题意】:一个女的找了一个比自己小的丈夫,没有人知道他们的年领差,但是知道他们的十二生肖。问女的至少比男的大多少岁。
【分析】如果两人属相相同,肯定大一轮,就是12.
如果女的属相比男的靠后,则就是12-(女的属相-男的属相)
如果女的属相比男的靠前,则就是(男的属相-女的属相)
【代码】:
| 15MS | 1948K |
#include <iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
#include<set>
#include<string>
using namespace std; int main()
{
int t;
string f,m;
cin>>t;
map<string,int> mp;
/*rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog and pig.*/
while(t--)
{
cin>>f>>m;
mp["rat"]=;
mp["ox"]=;
mp["tiger"]=;
mp["rabbit"]=;
mp["dragon"]=;
mp["snake"]=;
mp["horse"]=;
mp["sheep"]=;
mp["monkey"]=;
mp["rooster"]=;
mp["dog"]=;
mp[" pig"]=;
if(mp[f]==mp[m]) cout<<<<endl;
else if(mp[f]<mp[m]) cout<<abs(mp[f]-mp[m])<<endl;
else cout<<-abs(mp[f]-mp[m])<<endl;
}
return ;
}
HDU 6213 Chinese Zodiac 【模拟/水题/生肖】的更多相关文章
- Chinese Zodiac (水题)
The Chinese Zodiac, known as Sheng Xiao, is based on a twelve-year cycle, each year in the cycle rel ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- POJ 2014:Flow Layout 模拟水题
Flow Layout Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3091 Accepted: 2148 Descr ...
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- HDU 5590 ZYB's Biology 水题
ZYB's Biology Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid ...
- HDU 5538 L - House Building 水题
L - House Building Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- hdu 1005:Number Sequence(水题)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)T ...
- hdu 1018:Big Number(水题)
Big Number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total ...
- hdu 2041:超级楼梯(水题,递归)
超级楼梯 Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Submission(s): Accepted Su ...
随机推荐
- 【bzoj2631】tree LCT
题目描述 一棵n个点的树,每个点的初始权值为1.对于这棵树有q个操作,每个操作为以下四种操作之一:+ u v c:将u到v的路径上的点的权值都加上自然数c:- u1 v1 u2 v2:将树中原有的边( ...
- 【bzoj2815】[ZJOI2012]灾难 拓扑排序+倍增LCA
题目描述(转自洛谷) 阿米巴是小强的好朋友. 阿米巴和小强在草原上捉蚂蚱.小强突然想,果蚂蚱被他们捉灭绝了,那么吃蚂蚱的小鸟就会饿死,而捕食小鸟的猛禽也会跟着灭绝,从而引发一系列的生态灾难. 学过生物 ...
- 猜数字(C语言版)
编程先由计算机“想”一个1到100之间的数请人猜,如果人猜对了,则结束游戏,并在屏幕上输出人猜了多少次才猜对此数,以此来反映猜数者“猜”的水平,否则计算机给出提示,告诉人所猜的数是太大还是太小,最多可 ...
- C# 获取ORACLE SYS.XMLTYPE "遇到不支持的 Oracle 数据类型 USERDEFINED"
1.需要加函数 2.需要加表别名 select a.XML.getclobval() from TB1 a
- 洛谷 P1251 餐巾计划问题
题目链接 最小费用最大流. 每天拆成两个点,早上和晚上: 晚上可以获得\(r_i\)条脏毛巾,从源点连一条容量为\(r_i\),费用为0的边. 早上要供应\(r_i\)条毛巾,连向汇点一条容量为\(r ...
- jsp电子商务 购物车实现之一 设计篇
购物车的功能实现. 查询的资料,找到三种方法: 1.用cookie实现购物车: 2.用session实现购物车: 3.用cookie和数据库(购物车信息持久化)实现购物车: ============= ...
- bzoj4145 AMPPZ2014 The Prices 状压dp
这个题.......很可以,很小清晰......反正正经的东西我都没想到:重点在于——————我不会处理那个多出来的路费所以当时我就骚骚的弄了一颗树包状压其实这是一个类01背包的状压在每个状态用01背 ...
- HDU 1556 线段树/树状数组/区间更新姿势 三种方法处理
Color the ball Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)To ...
- Endnote 中文参考文献样式修改版
http://blog.yuelong.info/post/endnote-gbt7714-2005.html 很多人不知道 EndNote 是自带中文参考文献引用样式的,即符合<文后参考文献著 ...
- linux查看操作系统是多少位
有三种方法: 1.echo $HOSTTYPE 2.getconf LONG_BIT,此处不应该是getconf WORD_BIT命令,在64位系统中显示的是32 3.uname -a 出现" ...