各位数字全不同的下一天(MM/DD/YYYY)
Distinct Date I
题目详情
找“下一天”的日期,使得按 表示时出现的所有数字都互不相同。
例如 是合法的。用 的形式给出答案。
Find the next date where all of the digits, when expressed in the form are distinct. For example, would be a valid date. Express your answer in the form .
解析
为了尽量早,优先最小化年份,并分析月日中必须包含的 0/1/2 的位置。
综合约束后可得到最早满足条件的日期为 ,因此答案是
Original Explanation
We want to minimize the year, as that will be the biggest influence on how soon it is. Note that the first is either or . If the first is , then the first day must be or OR the day is ( doesn't work since we already have a ). If the first is , then either the second is a OR the second is a and the day contains a somewhere. Therefore, these both imply that the and either the or must be used in the portion. Since we ideally don't want to skip years, we should put the in the year portion, so thus far, we have that our date is in the form . After this, it's just an objective to minimize the rest of the digits. Namely, , as that is the smallest number that can be made with the remaining digits. Then, we want to minimize the month, so . Then, lastly, , as that is the smallest remaining number. Our answer is therefore .