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 ...
随机推荐
- 【bzoj2049】[Sdoi2008]Cave 洞穴勘测 LCT
题目描述 辉辉热衷于洞穴勘测.某天,他按照地图来到了一片被标记为JSZX的洞穴群地区.经过初步勘测,辉辉发现这片区域由n个洞穴(分别编号为1到n)以及若干通道组成,并且每条通道连接了恰好两个洞穴.假如 ...
- HTML5<canvas>标签:简单介绍(0)
<canvas> 标签是 HTML 5 中的新标签,像所有的dom对象一样它有自己本身的属性.方法和事件, 其中就有绘图的方法,js能够调用它来进行绘图 ,最近在研读<html5与c ...
- 【题解】IOI2005River 河流
一节语文课想出来的玩意儿,调了几个小时……可见细心&好的代码习惯是有多么的重要 (:へ:) 不过,大概竞赛最令人开心的就是能够一点一点的感受到自己的进步吧,一天比一天能够自己想出更多的题,A题 ...
- [LOJ#6437][BZOJ5373]「PKUSC2018」PKUSC
[LOJ#6437][BZOJ5373]「PKUSC2018」PKUSC 试题描述 九条可怜是一个爱玩游戏的女孩子. 最近她在玩一个无双割草类的游戏,平面上有 \(n\) 个敌人,每一个敌人的坐标为 ...
- BZOJ 1101 [POI2007]Zap | 第一道莫比乌斯反(繁)演(衍)
题目: http://www.lydsy.com/JudgeOnline/problem.php?id=1101 题解: http://www.cnblogs.com/mrha/p/8203612.h ...
- C#语法糖大汇总【转发】
首先需要声明的是“语法糖”这个词绝非贬义词,它可以给我带来方便,是一种便捷的写法,编译器会帮我们做转换:而且可以提高开发编码的效率,在性能上也不会带来损失.这让java开发人员羡慕不已,呵呵. 1. ...
- Light OJ 1074:Extended Traffic(spfa判负环)
Extended Traffic 题目链接:https://vjudge.net/problem/LightOJ-1074 Description: Dhaka city is getting cro ...
- 上海GDG活动有感
本周参加了场上海的GDG活动.本次活动的主办方 先介绍一下: GDG Shanghai 上海GDG(Google开发者社区,以前是GTUG, Google技术用户组) ,众所周知,Google的搜索引 ...
- bzoj 4879 失控的数位板 4881 线段游戏 贪心,瞎搞
[Lydsy1705月赛]失控的数位板 Time Limit: 30 Sec Memory Limit: 256 MBSubmit: 148 Solved: 33[Submit][Status][ ...
- c#之字符串函数
1.常用的字符串函数 Compare 比较字符串的内容,考虑文化背景(场所),确定某些字符是否相等 int Compare(string str1,string str2) int Compare(s ...