CF678B.The Same Calendar

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

The girl Taylor has a beautiful calendar for the year y. In the calendar all days are given with their days of week: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday.

The calendar is so beautiful that she wants to know what is the next year after y when the calendar will be exactly the same. Help Taylor to find that year.

Note that leap years has 366 days. The year is leap if it is divisible by 400 or it is divisible by 4, but not by 100 (https://en.wikipedia.org/wiki/Leap_year).

女孩泰勒拥有一本美丽的年历,对应年份为 yy。在这本年历中,每一天都标注了其对应的星期几:星期一、星期二、星期三、星期四、星期五、星期六和星期日。

这本年历非常精美,因此她想知道:在年份 yy 之后,下一个日历完全相同的年份是哪一年?请帮助泰勒找出该年份。

注意:闰年有 366 天。若某一年能被 400 整除,或能被 4 整除但不能被 100 整除,则该年为闰年(https://en.wikipedia.org/wiki/Leap_year)。

输入格式

The only line contains integer y (1000 ≤ y < 100'000) — the year of the calendar.

唯一一行包含一个整数 yy(1000≤y<100 0001000 \leq y < 100\,000)——日历的年份。

输出格式

Print the only integer y' — the next year after y when the calendar will be the same. Note that you should find the first year after y with the same calendar.

输出唯一的整数 y′y' —— 即年份 yy 之后日历完全相同的下一个年份。注意,你需要找到 yy 之后第一个日历完全相同的年份。

输入输出样例

  • 输入#1

    2016

    输出#1

    2044
  • 输入#2

    2000

    输出#2

    2028
  • 输入#3

    50501

    输出#3

    50507

说明/提示

Today is Monday, the 13th of June, 2016.

今天是2016年6月13日,星期一。

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

首页