CF611A.New Year and Days

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015.

Limak is a little polar bear. He enjoyed this year a lot. Now, he is so eager to the coming year 2016.

Limak wants to prove how responsible a bear he is. He is going to regularly save candies for the entire year 2016! He considers various saving plans. He can save one candy either on some fixed day of the week or on some fixed day of the month.

Limak chose one particular plan. He isn't sure how many candies he will save in the 2016 with his plan. Please, calculate it and tell him.

今天是星期三,即一周中的第三天。更有趣的是,明天就是2015年的最后一天。

Limak 是一只小北极熊。他非常享受今年的时光。现在,他热切地期盼着即将到来的2016年。

Limak 想要证明自己是一只多么有责任心的熊。他计划在整个2016年坚持存糖果!他考虑了多种储蓄方案:他可以在每周的某个固定星期几存一颗糖果,也可以在每月的某个固定日期存一颗糖果。

Limak 选择了一种特定的储蓄方案。但他不确定按照该方案,自己在2016年总共能存下多少颗糖果。请计算这个数量并告诉他。

输入格式

The only line of the input is in one of the following two formats:

  • "x of week" where x (1 ≤ x ≤ 7) denotes the day of the week. The 1-st day is Monday and the 7-th one is Sunday.
  • "x of month" where x (1 ≤ x ≤ 31) denotes the day of the month.

输入仅有一行,格式为以下两种之一:

  • “x of week”,其中 x(1 ≤ x ≤ 7)表示星期中的第几天。第 1 天为星期一,第 7 天为星期日。
  • “x of month”,其中 x(1 ≤ x ≤ 31)表示月份中的第几天。

输出格式

Print one integer — the number of candies Limak will save in the year 2016.

输出一个整数——Limak 在 2016 年将节省的糖果数量。

输入输出样例

  • 输入#1

    4 of week

    输出#1

    52
  • 输入#2

    30 of month

    输出#2

    11

说明/提示

Polar bears use the Gregorian calendar. It is the most common calendar and you likely use it too. You can read about it on Wikipedia if you want to – https://en.wikipedia.org/wiki/Gregorian_calendar. The week starts with Monday.

In the first sample Limak wants to save one candy on each Thursday (the 4-th day of the week). There are 52 Thursdays in the 2016. Thus, he will save 52 candies in total.

In the second sample Limak wants to save one candy on the 30-th day of each month. There is the 30-th day in exactly 11 months in the 2016 — all months but February. It means that Limak will save 11 candies in total.

北极熊使用公历(格里高利历)。这是目前最常用的历法,你很可能也在使用它。如果你想了解更多,可以参阅维基百科:https://en.wikipedia.org/wiki/Gregorian_calendar。每周从星期一开始。

在第一个样例中,Limak 希望每周四(一周中的第 4 天)各存一颗糖。2016 年共有 52 个星期四,因此他总共将存下 52 颗糖。

在第二个样例中,Limak 希望每月的第 30 天各存一颗糖。2016 年中,恰好有 11 个月包含第 30 天——即除二月外的所有月份。这意味着 Limak 总共将存下 11 颗糖。

输入解题思路,AI测评打分。不知道怎么写?

首页