QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100

#3416. 第一次约会

Statistics

1582 年,教皇格列高利十三世颁布了一项历法改革,旨在使历法年的平均长度(以天数计)更接近天文年的实际天数。这项历法改革涉及从儒略历向格列高利历的过渡。

儒略历和格列高利历都有平年(365 天)和所谓的闰年(366 天)。在平年中,二月有 28 天,而在闰年中,二月会多出一天“闰日”:2 月 29 日。

儒略历和格列高利历之间唯一的区别在于判断闰年的规则。在儒略历中,能被 4 整除的年份即为闰年。格列高利历判断闰年的规则稍微复杂一些:能被 4 整除的年份是闰年,但能被 100 整除而不能被 400 整除的年份除外。

遵循这些规则,1600 年、1700 年、1800 年、1900 年、2000 年、2100 年、2200 年、2300 年和 2400 年在儒略历中都是闰年。而在格列高利历中,该列表中只有 1600 年、2000 年和 2400 年是闰年。

旧的儒略历平均年长为 365.25 天,而新的格列高利历平均年长为 365.2425 天。鉴于天文年的实际天数约为 365.24219 天,可以看出格列高利历是一种改进。

作为格列高利改革的一部分,为了抵消使用儒略历 1500 多年带来的影响,一些日期被跳过了。具体而言,格列高利改革规定,1582 年 10 月 4 日(儒略历)之后紧接着是 1582 年 10 月 15 日(格列高利历)。

然而,到 16 世纪末,宗教改革正如火如荼地进行。虽然天主教国家倾向于遵循教皇的法令,但许多国家直到很久以后才继续使用儒略历。例如,英国在 1752 年 9 月 2 日(儒略历)切换到格列高利历,紧接着是 1752 年 9 月 14 日(格列高利历)——到那时,为了完成切换,必须跳过 11 天。最后一个切换的欧洲国家是希腊,它直到 1923 年 2 月 15 日(儒略历)才完成过渡,紧接着是 1923 年 3 月 1 日(格列高利历),跳过了 13 天。

任务

给定某个国家使用儒略历的最后一天(以儒略历日期表示),确定下一天的格列高利历日期,即使用格列高利历的第一天。

输入格式

对于每个测试用例,输入包含一行以儒略历表示的日期,格式为 YYYY-MM-DD。该日期不早于 1582 年 10 月 4 日,且不晚于 9999 年 10 月 18 日。给定的日期代表该国使用儒略历的最后一天。

输出格式

对于每个测试用例,输出历法转换后的第一个格列高利历日期。

样例

输入 1

1582-10-04
1752-09-02
1900-02-25
1923-02-15

输出 1

1582-10-15
1752-09-14
1900-03-10
1923-03-01

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.