博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Chinese Zodiac (水题)
阅读量:5049 次
发布时间:2019-06-12

本文共 1539 字,大约阅读时间需要 5 分钟。

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 22 years. But if the signs of the couple is the same, the answer should be 1212 years.

Input

The first line of input contains an integer T (1≤T≤1000)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

3ox roosterrooster oxdragon dragon

Sample Output

8412

题解:感觉用map更好,但是我STL玩的还是不是特别好,就用二维字符数组代替了

代码:

#include
#include
#include
#include
#include
using namespace std;int main(){ char a[12][15]={"rat","ox","tiger","rabbit","dragon","snake","horse","sheep","monkey","rooster","dog","pig"}; int n; cin>>n; char s1[15],s2[15]; int k1,k2; for(int t=0;t
k2) { printf("%d\n",12+k2-k1); } } return 0;}

 

转载于:https://www.cnblogs.com/Staceyacm/p/10781963.html

你可能感兴趣的文章
mysql 多表管理修改
查看>>
group by order by
查看>>
bzoj 5252: [2018多省省队联测]林克卡特树
查看>>
https 学习笔记三
查看>>
Oracle学习之简单查询
查看>>
log4j配置
查看>>
linux 配置SAN存储-IPSAN
查看>>
双链表
查看>>
java学习笔记之String类
查看>>
pymysql操作mysql
查看>>
Linux服务器删除乱码文件/文件夹的方法
查看>>
牛腩记账本core版本源码
查看>>
Word Break II
查看>>
UVA 11082 Matrix Decompressing 矩阵解压(最大流,经典)
查看>>
BZOJ4669抢夺(费用流+二分答案)
查看>>
bzoj1606
查看>>
jdk从1.8降到jdk1.7失败
查看>>
一些关于IO流的问题
查看>>
mongo备份操作
查看>>
8 -- 深入使用Spring -- 3...1 Resource实现类InputStreamResource、ByteArrayResource
查看>>