2017青岛网络赛1008 Chinese Zodiac
Chinese Zodiac
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2451 Accepted Submission(s): 1645
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.
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
Statistic | Submit | Clarifications | Back
题意:十二生肖大循环
思路:比较水
#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;
}
}
2017青岛网络赛1008 Chinese Zodiac的更多相关文章
- HDU 6212 Zuma 2017青岛网络赛 区间DP
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6212 解法:看了眼题就发现这个BZOJ 1032不是一毛一样?但是BZOJ上那是个巨坑,数据有错,原来 ...
- 2017青岛网络赛1011 A Cubic number and A Cubic Number
A Cubic number and A Cubic Number Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/3276 ...
- 2017 青岛网络赛 Chenchen, Tangtang and ZengZeng
Chenchen, Tangtang and ZengZeng are starting a game of tic-tac-toe, played on a 3 × 3 board. Initial ...
- 2017 ACM/ICPC Asia Regional Qingdao Online - 1008 Chinese Zodiac
2017-09-17 13:28:04 writer:pprp 签到题:1008 Chinese Zodiac #include <iostream> #include <strin ...
- HDU 4745 Two Rabbits (2013杭州网络赛1008,最长回文子串)
Two Rabbits Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Tota ...
- HDU 5880 Family View (2016 青岛网络赛 C题,AC自动机)
题目链接 2016 青岛网络赛 Problem C 题意 给出一些敏感词,和一篇文章.现在要屏蔽这篇文章中所有出现过的敏感词,屏蔽掉的用$'*'$表示. 建立$AC$自动机,查询的时候沿着$fa ...
- 2017乌鲁木齐网络赛 j 题
题目连接 : https://nanti.jisuanke.com/t/A1256 Life is a journey, and the road we travel has twists and t ...
- hdu 6152 : Friend-Graph (2017 CCPC网络赛 1003)
题目链接 裸的结论题.百度 Ramsey定理.刚学过之后以为在哪也不会用到23333333333,没想到今天网络赛居然出了.顺利在题面更改前A掉~~~(我觉得要不是我开机慢+编译慢+中间暂时死机,我还 ...
- 2017 ICPC网络赛(西安)--- Xor
题目连接 Problem There is a tree with n nodes. For each node, there is an integer value ai, (1≤ai≤1,000 ...
随机推荐
- msp430入门学习23
msp430的ADC(模数转换) msp430入门学习
- FZU Problem 2171 防守阵地 II (线段树区间更新模板题)
http://acm.fzu.edu.cn/problem.php?pid=2171 成段增减,区间求和.add累加更新的次数. #include <iostream> #include ...
- Rikka with Phi 线段树
Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds ...
- SQLSERVER数据库管理员的专用连接DAC
出处: http://www.cnblogs.com/lyhabc/archive/2012/09/23/2698702.html DAC:Dedicated Admin Connection 当SQ ...
- [bzoj3894]文理分科_网络流_最小割
文理分科 bzoj-3894 题目大意:题目链接. 注释:略. 想法: 这种题也是一种套路. 我们新建一个点表示收益点. 然后把所有的收益都加一起,求最小割表示代价即可. Code: #include ...
- c++ stl 使用汇总(string,vector,map,set)
1.string 1>substr(),截取字串的方法.返回一个从指定位置开始,并具有指定长度的子字符串.参数 start(必选),所需的子字符串的起始位置.字符串中第一个字符的索引为 0.le ...
- docker: 通过docker方式安装jenkins
1. docker pull jenkins 2. docker run -d -p 49001:8080 -v $PWD/jenkins:/var/jenkins_home:z -t jenkins ...
- Oracle 远程访问配置 在 Windows Forms 和 WPF 应用中使用 FontAwesome 图标 C#反序列化XML异常:在 XML文档(0, 0)中有一个错误“缺少根元素” C#[Win32&WinCE&WM]应用程序只能运行一个实例:MutexHelper Decimal类型截取保留N位小数向上取, Decimal类型截取保留N位小数并且不进行四舍五入操作
Oracle 远程访问配置 服务端配置 如果不想自己写,可以通过 Net Manager 来配置. 以下配置文件中的 localhost 改为 ip 地址,否则,远程不能访问. 1.网络监听配置 ...
- HDU 4352 XHXJ's LIS(数位dp&状态压缩)
题目链接:[kuangbin带你飞]专题十五 数位DP B - XHXJ's LIS 题意 给定区间.求出有多少个数满足最长上升子序列(将数看作字符串)的长度为k. 思路 一个数的上升子序列最大长度为 ...
- POJ1469 COURSES 【二分图最大匹配·HK算法】
COURSES Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17777 Accepted: 7007 Descript ...