Kattis-Astrological Sign

Posted 做一个AC梦

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Kattis-Astrological Sign相关的知识,希望对你有一定的参考价值。

题目所述基本内容

Harry Potter and his friends are now fourth-year students at Hogwarts School of Witchcraft and Wizardry. This year, one of their subjects is Astrology. To become a successful wizard, Astrology is crucial, as it allows one to predict future events or gain insights into people’s personalities and relationships.

In the first lecture, Harry Potter and his friends need to learn and understand Astrological Signs. One’s Astrological Sign is determined by their birthday, according to the following table:

For example, if one’s birthday is on May 5th, their Astrological Sign is Taurus, as it lies between Apr 21st and May 20th.

Today Harry Potter wants to determine the Astrological Sign of all his classmates. Please help him!

输入输出样例

Input

The first line of the input contains a single integer t (1≤t≤1000) — the number of Harry Potter’s classmates.

In the next t line, each line contains a birthday in the format d m, where d is the date, and m is the first three letters of the name of the month (with the first letter in uppercase, the second and third letters in lowercase). It is guaranteed that all the given dates are valid.

Output

Print t lines, each line contains the name of the Astrological Sign.

Sample Input 1Sample Output 1
2
5 May
30 Jul
Taurus
Leo

 代码

#include<iostream>
#include<vector>
#include<string>
#define MAX 10001
using namespace std;
int main() 
	vector<int>a(MAX);
	vector<string>b(MAX);
	vector<string>result;
	int t = 0;
	int s = 0;
	string str;
	cin >> t;
	for (int i = 0; i < t; i++) 
		cin >> s>> str;
		a[i]=s;
		b[i]=str;
	
	for (int i = 0; i < t; i++) 
		if (((a[i] >= 21 && a[i] <= 31) && (b[i] == "Mar")) || ((a[i] >= 1 && a[i] <= 20) && (b[i] == "Apr"))) 
			result.push_back("Aries");
		
		else if (((a[i] >= 21 && a[i] <= 30) && (b[i] == "Apr")) || ((a[i] >= 1 && a[i] <= 20) && (b[i] == "May"))) 
			result.push_back("Taurus");
		
		else if (((a[i] >= 21 && a[i] <= 31) && (b[i] == "May")) || ((a[i] >= 1 && a[i] <= 21) && (b[i] == "Jun"))) 
			result.push_back("Gemini");
		
		else if (((a[i] >= 22 && a[i] <= 30) && (b[i] == "Jun")) || ((a[i] >= 1 && a[i] <= 22) && (b[i] == "Jul"))) 
			result.push_back("Cancer");
		
		else if (((a[i] >= 23 && a[i] <= 31) && (b[i] == "Jul")) || ((a[i] >= 1 && a[i] <= 22) && (b[i] == "Aug"))) 
			result.push_back("Leo");
		
		else if (((a[i] >= 23 && a[i] <= 31) && (b[i] == "Aug")) || ((a[i] >= 1 && a[i] <= 21) && (b[i] == "Sep"))) 
			result.push_back("Virgo");
		
		else if (((a[i] >= 22 && a[i] <= 30) && (b[i] == "Sep")) || ((a[i] >= 1 && a[i] <= 22) && (b[i] == "Oct"))) 
			result.push_back("Libra");
		
		else if (((a[i] >= 23 && a[i] <= 31) && (b[i] == "Oct")) || ((a[i] >= 1 && a[i] <= 22) && (b[i] == "Nov"))) 
			result.push_back("Scorpio");
		
		else if (((a[i] >= 23 && a[i] <= 30) && (b[i] == "Nov")) || ((a[i] >= 1 && a[i] <= 21) && (b[i] == "Dec"))) 
			result.push_back("Sagittarius");
		
		else if (((a[i] >= 22 && a[i] <= 31) && (b[i] == "Dec")) || ((a[i] >= 1 && a[i] <= 20) && (b[i] == "Jan"))) 
			result.push_back("Capricorn");
		
		else if (((a[i] >= 21 && a[i] <= 31) && (b[i] == "Jan")) || ((a[i] >= 1 && a[i] <= 19) && (b[i] == "Feb"))) 
			result.push_back("Aquarius");
		
		else if (((a[i] >= 20 && a[i] <= 30) && (b[i] == "Feb")) || ((a[i] >= 1 && a[i] <= 20) && (b[i] == "Mar"))) 
			result.push_back("Pisces");
		
	
	for (int i = 0; i < t; i++) 
		cout << result[i] << endl;
	

结束语

好兄弟好兄弟,留下你的关注和点赞,666走一波!!!!!

以上是关于Kattis-Astrological Sign的主要内容,如果未能解决你的问题,请参考以下文章

sign in 和 sign up 的区别

SIGN(x)

oracle 的sign函数

ASIC设计中的sign-off

英语sign in和sign up区别是啥?

「注册」英文怎么说?秒懂sign up/sign in/log in!