Chinese Zodiac

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 184    Accepted Submission(s): 135

Problem Description

The Chinese Zodiac, known as Sheng Xiao, is based on a twelve-year cycle, each year in the cycle related to an animal sign. These signs are the rat, ox, tiger, rabbit, dragon, snake, horse, sheep, monkey, rooster, dog and pig.
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.
 

Input

The first line of input contains an integer T (1≤T≤1000) indicating the number of test cases.
For each test case a line of two strings describes the signs of Victoria and her husband.
 

Output

For each test case output an integer in a line.
 

Sample Input

3
ox rooster
rooster ox
dragon dragon
 

Sample Output

8
4
12
 

Source

 
 //2017-09-18
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map> using namespace std; map<string, int> mp; int main()
{
mp["rat"] = ;
mp["ox"] = ;
mp["tiger"] = ;
mp["rabbit"] = ;
mp["dragon"] = ;
mp["snake"] = ;
mp["horse"] = ;
mp["sheep"] = ;
mp["monkey"] = ;
mp["rooster"] = ;
mp["dog"] = ;
mp["pig"] = ; int T;
cin>>T;
string str1, str2;
while(T--){
cin>>str1>>str2;
int ans = ((mp[str2]-mp[str1])+)%;
if(ans == )ans = ;
cout<<ans<<endl;
} return ;
}

HDU6213的更多相关文章

随机推荐

  1. elasticsearch 安装,以及遇到的问题总结

    系统.软件环境: Centos 6.5 elasticsearch 6.1.1 elasticsearch 安装的话是很简单的,但是安装完成启动的时候报错,下面我就一一的来描述错误,并提供相应的解决方 ...

  2. C#顺序表 & 单向链表(无头)

    C# 顺序表 非常标准的顺序表结构,等同于C#中的List<T>,但是List<T>在排错查询和数据结构替换上存在缺陷,一些情况会考虑使用自己定义的数据结构 1.优化方向 下表 ...

  3. Ubuntu 安装 chrome浏览器

    按下 Ctrl + Alt + t 键盘组合键,启动终端. 输入以下命令: sudo wget http://www.linuxidc.com/files/repo/google-chrome.lis ...

  4. 背水一战 Windows 10 (84) - 用户和账号: 微软账号的登录和注销

    [源码下载] 背水一战 Windows 10 (84) - 用户和账号: 微软账号的登录和注销 作者:webabcd 介绍背水一战 Windows 10 之 用户和账号 微软账号的登录和注销 示例演示 ...

  5. Maven - Tips

    1- Maven的Settings http://maven.apache.org/settings.html 2- Maven设置代理 示例: <proxies> <proxy&g ...

  6. HoloLens开发手记 - 语音输入 Voice input

    语音是HoloLens三大重要输入形式之一.它允许你直接通过语言控制全息图像,而不用借助手势.你只要凝视全息图像然后说出语音命令即可.语音输入是自然的交互方式,它能够很好的改善复杂的交互,因为通过一条 ...

  7. HoloLens开发手记-凝视 Gaze

    在全息应用中,凝视是第一种输入形式,被用于定位物体(功能和PC的光标指针类似).凝视告诉你用户正在看向世界中的位置,让你能够确定他们的意图.在现实世界中,你通常会盯着你打算与之交互的物体.这种方式与凝 ...

  8. JAVA实现调用微信js-sdk扫一扫

    喜欢的朋友可以关注下. 已经很久没有给大家分享一片技术文章了,今天抽了点时间来,给大家说一说如何调用微信提供的扫一扫接口. 前提: 需要申请一个公众号:申请公众号需要的资料我就不说了,去申请微信会提示 ...

  9. hdu 6127---Hard challenge(思维)

    题目链接 Problem Description There are n points on the plane, and the ith points has a value vali, and i ...

  10. hdu 5116--Everlasting L(计数DP)

    题目链接 Problem Description Matt loves letter L. A point set P is (a, b)-L if and only if there exists ...