CF260B.Ancient Prophesy
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A recently found Ancient Prophesy is believed to contain the exact Apocalypse date. The prophesy is a string that only consists of digits and characters "-".
We'll say that some date is mentioned in the Prophesy if there is a substring in the Prophesy that is the date's record in the format "dd-mm-yyyy". We'll say that the number of the date's occurrences is the number of such substrings in the Prophesy. For example, the Prophesy "0012-10-2012-10-2012" mentions date 12-10-2012 twice (first time as "0012-10-2012-10-2012", second time as "0012-10-2012-10-2012").
The date of the Apocalypse is such correct date that the number of times it is mentioned in the Prophesy is strictly larger than that of any other correct date.
A date is correct if the year lies in the range from 2013 to 2015, the month is from 1 to 12, and the number of the day is strictly more than a zero and doesn't exceed the number of days in the current month. Note that a date is written in the format "dd-mm-yyyy", that means that leading zeroes may be added to the numbers of the months or days if needed. In other words, date "1-1-2013" isn't recorded in the format "dd-mm-yyyy", and date "01-01-2013" is recorded in it.
Notice, that any year between 2013 and 2015 is not a leap year.
最近发现的一则古代预言被认为精确记载了世界末日的日期。该预言是一段仅由数字和字符“-”组成的字符串。
若预言中存在某个子串,其格式为“dd-mm-yyyy”,且恰好对应某一天的日期,则称该日期在预言中被提及。该日期在预言中出现的次数,即为该格式子串在预言中出现的次数。例如,预言字符串“0012-10-2012-10-2012”中,日期 12-10-2012 被提及了两次(第一次出现在子串“0012-10-2012-10-2012”中,第二次出现在子串“0012-10-2012-10-2012”中)。
世界末日的日期定义为:在所有合法日期中,其在预言中被提及的次数严格大于其他任意合法日期的提及次数。
一个日期是合法的,当且仅当:年份位于 2013 至 2015(含)之间,月份为 1 至 12(含)之间的整数,日期为严格大于 0 且不超过该月实际天数的整数。注意,日期必须以“dd-mm-yyyy”格式书写,这意味着必要时可在月份或日期数字前补前导零。换言之,“1-1-2013”不符合“dd-mm-yyyy”格式,而“01-01-2013”符合该格式。
请注意:2013 至 2015 年间的任意一年均不是闰年。
输入格式
The first line contains the Prophesy: a non-empty string that only consists of digits and characters "-". The length of the Prophesy doesn't exceed 105 characters.
第一行包含预言:一个非空字符串,仅由数字和字符“-”组成。预言的长度不超过 105 个字符。
输出格式
In a single line print the date of the Apocalypse. It is guaranteed that such date exists and is unique.
在一行中输出“世界末日”的日期。保证该日期存在且唯一。
输入输出样例
输入#1
777-444---21-12-2013-12-2013-12-2013---444-777
输出#1
13-12-2013
输入解题思路,AI测评打分。不知道怎么写?