欢迎使用CSDN-markdown编辑器
来源:互联网 发布:如何评价杨振宁知乎 编辑:程序博客网 时间:2024/06/14 17:53
A题hint有更新,请注意
Problem N: Chinese Zodiac
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 114 Solved: 23
[Submit][Status][BBS]
Description
Chinese Zodiac are twelve cute animals, everyone have only one Chinese Zodiac, and it according to the date of birth. In the Chengdu Neusoft University, If two persons have same Chinese Zodiac, they are thought destined whatever they are both boy, girl and one boy and girl. Now, AngelaGirl want to know whether she is destined with someone.
The Chinese Zodiac includes Rat, Ox, Tiger, Hare, Dragon, Snake, Horse, Sheep, Monkey, Cock, Dog and Boar in order.
Input
The first line contains a single number T ( 1 < = T < = 200 ), indicating the test cases.
Each test case begin with a integer Y ( 1960 < = Y < = 2015 ) indicating the birth year of AngelaGirl.
The next line contains a Integer n ( 1 < = n < = 1000 ) indicating the number of persons who may be destined with AngelaGirl.
Each of next n lines contains a string and an integer, indicating the name and birth year of this person. The length of name at most is 30.
Output
For each test case, the first line format is Case #x:, the x is the data number begin with 1. The next n lines, if AngelaGirl is destined with the person, output “Destined” and the Chinese Zodiac. If not, Output the AnglelaGirl’s Chinese Zodiac first, and output the name and Chinese Zodiac of the person.
Sample Input
2
1992
2
Bob 2000
Alice 2004
2000
1
Mars 2001
Sample Output
Case #1:
Monkey Bob Dragon
Destined Monkey
Case #2:
Dragon Mars Snake
题意输入:
第一行是有几个测试数据,第二行就是要比较这个人出生的属相,第三行输入要比较的人,如果是同一个属相就输出Destined Monkey,不是就输出你输入这个人年数的属相和你判断这个人的属相,本题是水题,(但是我是渣渣,赛要结束时才看到了,本届校赛以本人爆0结束)
上代码:
#include<stdio.h>char str1[12][100]= {{"Monkey"},{"Cock"},{"Dog"},{"Boar"},{"Rat"},{"Ox"},{"Tiger"},{"Hare"},{"Dragon"},{"Snake"},{"Horse"},{"Sheep"}};//首先定义12个生肖的顺序//在此之前你要明白年数%12就是这个字符串1数组的下标。int main(){ int n; while(scanf("%d",&n)!=EOF) { int i; for(i = 1; i <= n; i++) { int T; scanf("%d",&T); int num1 = T%12; int m; scanf("%d",&m); int j; char str[1000][1000]; int num[1010]; for(j = 0; j < m; j++) { scanf("%s%d",&str[j],&num[j]); } if( T >= 1960 &&T <= 2015 ) { printf("Case #%d:\n",i); for(j = 0; j < m; j++) { int t=num[j]%12; if(num1 == t) { printf("Destined %s\n",str1[num1]); } if(num1 != t) { //printf("Case #%d:\n",i); printf("%s %s %s\n",str1[num1],str[j],str1[t]); } } } } } return 0;}
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 欢迎使用CSDN-markdown编辑器
- 遍历设计模式
- 简单的javascript计算器
- HDU 4221 Greedy?(贪心)
- C语言 素数三种思路求解
- 负数的表示方法:2的补码和1的补码
- 欢迎使用CSDN-markdown编辑器
- akka入门-Futures
- 在C++中调用DLL中的函数
- how to lock statistics for the tables
- UML-部署图
- 最小二乘法(一般形式和矩阵形式)
- DesignPatterns_Strategy
- 一种方便的动态库动态加载机制
- android 倒计时实现