HDU 1491(Octorber 21st)

基础题。

#include <iostream>
using namespace std;

int num[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };

int main()
{
	int T;
	cin >> T;
	int month, day;
	while (T--)
	{
		cin >> month >> day;
		if (month > 10)
			cout << "What a pity, it has passed!" << endl;
		else if (month < 10)
		{
			int total = 0;
			total += (num[month] - day + 1);
			for (int i = month + 1; i < 10; i++)
				total += num[i];
			total += 20;
			cout << total << endl;
		}
		else
		{
			if (day > 21)
				cout << "What a pity, it has passed!" << endl;
			else if (day < 21)
				cout << 21 - day << endl;
			else
				cout << "It's today!!" << endl;
		}
	}
	return 0;
}

继续加油。

发布了332 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/Intelligence1028/article/details/105678423
今日推荐