QOJ.ac

QOJ

時間限制: 2.0 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#16777. 退休年龄

统计

在某个国家,决定自 2012 年 1 月 1 日起开始提高退休年龄。在此日期之前,退休年龄为 60 岁。

提高退休年龄的具体实施方式如下。延迟退休总共重复 $K$ 次。每次,退休年龄增加 $M$ 个月。第一次增加发生在 2012 年 1 月 1 日,接下来的 $(K - 1)$ 次增加每次都发生在上一次增加的 $N$ 个月之后($N > M$)。例如,设 $M = 3$。那么出生于 1951 年 12 月 31 日的公民将在 2011 年 12 月 31 日退休;而出生于 1952 年 1 月 1 日的公民将在 2012 年 4 月 1 日退休。

某个人的退休日期是满足该人年龄不小于该日期批准的退休年龄的最小可能日期。

为了确定公民何时满 $I$ 岁 $J$ 个月,您需要将 $I$ 年和 $J$ 个月加到其出生日期上,保持月份中的天数不变。如果日历中不存在这一天,则所需的日期为下个月的第一天。因此,在 $M = 3$ 且 $N = 5$ 的情况下,出生于 1952 年 1 月 31 日的人将在 2012 年 5 月 1 日退休,出生于 1952 年 2 月 1 日的人也是如此。

要求在给定公民出生日期的情况下,确定其退休日期。假设人的寿命可以任意长。

如果年份能被 400 整除,或者能被 4 整除但不能被 100 整除,则该年为闰年。

输入格式

输入的第一行包含三个整数 $M$,$N$ 和 $K$($0 < M \le 12$,$M < N \le 24$,$0 \le K \le 60$)。

输入的第二行包含一个公民的出生日期,格式为 DD.MM.YYYY(即日、月、年,不含引号,对于小于 10 的数字带有前导零)。所有日期均在 01.01.190031.12.2100 之间。

输出格式

以与输入日期相同的格式输出该公民的退休日期。

样例

输入样例 1

3 6 20
01.01.1952

输出样例 1

01.04.2012

输入样例 2

3 5 1
31.01.1952

输出样例 2

01.05.2012

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.