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走一波!!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

做一个AC梦

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值