HDU-6213-Chinese Zodiac(水题)
来源:互联网 发布:如何开通淘宝视频直播 编辑:程序博客网 时间:2024/05/21 11:05
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
题意:妹子和一个比她年轻的人结婚了,给你他们两个人的生肖,让你求他们两个人最小的年龄差,注意下妹子比她丈夫大就行了,水题。
思路:随便写。
代码:
#include<iostream> #include<cstdio> #include<cstring> #include<string.h> #include<stdio.h> using namespace std; int main() { char x[12][10]={"rat","ox","tiger","rabbit","dragon","snake","horse","sheep","monkey","rooster","dog","pig"}; char a[10],b[10]; int i,s1,s2,t; cin>>t; while(t--) { cin>>a>>b; if(strcmp(a,b)==0) { cout<<12<<endl; continue; } for(i=0;i<12;i++) { if(strcmp(a,x[i])==0) s1=i; if(strcmp(b,x[i])==0) s2=i; } if(s1<s2) cout<<(s1-s2)*-1<<endl; else cout<<12-s1+s2<<endl; } return 0; }总结:水题。
阅读全文
0 0
- HDU-6213-Chinese Zodiac(水题)
- HDU 6213-Chinese Zodiac
- HDU 6213 Chinese Zodiac(水题,模拟)
- hdu 6213 Chinese zodiac(map)
- hdu 6213-Chinese Zodiac (map)
- 航院 6213 Chinese Zodiac
- hdoj 6213 Chinese Zodiac
- 航院 6213 Chinese Zodiac
- Chinese Zodiac(水题)
- Chinese Zodiac
- Chinese Zodiac
- Chinese Zodiac
- Chinese Zodiac
- 【2017 ACM/ICPC Asia Regional Qingdao Online 1008】hdu 6213 Chinese Zodiac
- Chinese Zodiac(1)
- zoj 3479 Chinese Zodiac
- ZOJ 3479 Chinese Zodiac
- ZOJ 3479 Chinese Zodiac
- Mybatis入门学习(二)
- [嵌入式Linux驱动]S5PV210的蜂鸣器Linux驱动
- 排序算法_2,快速排序
- 关于引用(一)
- 2018网易--游历魔法王国
- HDU-6213-Chinese Zodiac(水题)
- 两个有序链表序列的合并
- 动态规划——旅行推销员问题
- Android中使用Activity管理类
- Step by Step——数据库-char & varchar & nvarchar
- 快速排序【递归分治法】
- linux 安装mysql5.6
- FL Studio 12.3.73破解版下载
- 事件