HDU6213
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
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
For each test case a line of two strings describes the signs of Victoria and her husband.
Output
Sample Input
Sample Output
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的更多相关文章
随机推荐
- 分支结构-Switch
/* switch(表达式或变量){ case value1:{ 语句体1; break; } case value2:{ 语句体2; break; } ... default:{ 语句体n+1; b ...
- WPF 显示 mp3 专辑图片
mp3 专辑图片是属于 mp3 的 tag 的一部分,安装 taglib# 的 nuget 安装包到项目.这里使用 TagLib.Portable https://www.nuget.org/pack ...
- 9.7 翻译系列:EF数据注解特性之--InverseProperty【EF 6 Code-First系列】
原文链接:https://www.entityframeworktutorial.net/code-first/inverseproperty-dataannotations-attribute-in ...
- PHP 生成验证码(+图片没有显示的解决办法)
今天有需要用到验证码,就敲了个,毕竟用途比较广,所以打算把代码留下来,以后肯定用得上的.当然,今天在做的时候也是有一些问题的,分享出来吧,记录自己所犯的错误,避免以后再掉坑里. 先给个效果图(下面的真 ...
- Dot & cross product
https://www.khanacademy.org/math/linear-algebra/vectors-and-spaces/dot-cross-products/v/vector-dot-p ...
- JavaScript控制页码的显示与隐藏
前端页面开发分页显示功能时,一般都要求使用自定义的页码样式,直接用网上分页插件就比较麻烦了,这里记录一下工作中总结的一个比较简单通用的控制页码显示与隐藏的的js代码. 首先是使用时需要自己根据自己具体 ...
- Java学习笔记31(集合框架五:set接口、哈希表的介绍)
set接口的特点: 1.不包含重复元素 2.set集合没有索引,只能用迭代器或增强for循环遍历 3.set的底层是map集合 方法和Collection的方法基本一样 set接口的实现类HashSe ...
- linux上面是否有安装redis,redis启动
1.进入/usr/local/src目录,下载redis # cd /usr/local/src# wget http://download.redis.io/releases/redis-4.0.6 ...
- 初涉Java方法
初涉Java方法 方法就是一段可重复调用的代码段,方法命名规范,第一个单词小写,从第二个单词开始首字母均大写. 格式: public static 返回值类型 ...
- $.parseJson()定义和用法
$.parseJSON() 函数用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象. 例子: 这里首先给出JSON字符串集,字符串集如下: var data=" { ...