2017青岛网络赛1008 Chinese Zodiac
来源:互联网 发布:mongodb删除数据 编辑:程序博客网 时间:2024/05/16 10:20
Chinese Zodiac
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2451 Accepted Submission(s): 1645
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 be2 years. But if the signs of the couple is the same, the answer should be 12 years.
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
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.
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
Source
输入输出测试
题意:十二生肖大循环
思路:比较水
#include <iostream>#include<vector>#include<string>using namespace std;int main(){ vector< string>vec; vec.push_back("rat"); //vec[0].second=1; vec.push_back("ox"); //vec[1].second=2; vec.push_back("tiger"); //vec[2].second=3; vec.push_back("rabbit"); //vec.push_back("monkey"); vec.push_back("dragon"); vec.push_back("snake"); vec.push_back("horse"); vec.push_back("sheep"); vec.push_back("monkey"); vec.push_back("rooster"); vec.push_back("dog"); vec.push_back("pig"); int t; cin>>t; while(t--) { string str1,str2; cin>>str1>>str2; int cnt1,cnt2; for(int i=0;i<=11;i++) { if(vec[i]==str1) { cnt1=i+1; break; } } for(int j=0;j<=11;j++) { if(vec[j]==str2) { cnt2=j+1; break; } } if(cnt2-cnt1>0) cout<<cnt2-cnt1<<endl; else cout<<cnt2-cnt1+12<<endl; }}
阅读全文
0 0
- 2017青岛网络赛1008 Chinese Zodiac
- 2017 icpc 青岛赛区 1008.Chinese Zodiac
- Chinese Zodiac---ACM青岛Regional
- 1008Chinese Zodiac
- 2017 ACM/ICPC Asia Regional Qingdao Online:1008 Chinese Zodiac
- Chinese Zodiac
- Chinese Zodiac
- Chinese Zodiac
- Chinese Zodiac
- 【2017 ACM/ICPC Asia Regional Qingdao Online 1008】hdu 6213 Chinese Zodiac
- HDU-2017 ACM/ICPC Asia Regional Qingdao Online-1008-Chinese Zodiac
- Chinese Zodiac(1)
- zoj 3479 Chinese Zodiac
- ZOJ 3479 Chinese Zodiac
- ZOJ 3479 Chinese Zodiac
- zoj-3479-Chinese Zodiac
- 航院 6213 Chinese Zodiac
- Chinese Zodiac(水题)
- Java笔记之形参个数可变的方法
- 如何版本化你的API?
- Arduino使用HC05蓝牙模块与手机连接
- 比较重量(网易笔试题)
- cmd中netstat 命令详解(四)
- 2017青岛网络赛1008 Chinese Zodiac
- woocommerce中将可变商品的下拉选项框改为淘宝类似的款式点选
- Linux 内核list_head 学习(一)
- Windows批处理.bat检测是否安装某些软件
- 线性神经网络在Matlab中实现
- Android 沉浸式状态栏的三种实现方式
- Dlib库介绍(一)
- BigDecimal加减乘除运算
- 反射_程序集_额外补充