注意:由于我本人是荷兰人,dd-MM-yyyy
因此挑战说明和测试用例中的所有日期均为荷兰语格式。
挑战:
输入:
开始日期;结束日期;数字
输出:
范围内的所有日期(包括双方),其日期中包含位数的唯一数字。
例:
输入:开始时间:12-11-1991
; 结束日期:02-02-1992
; 数字:4
输出:
天/月的前导0:
[20-11-1991, 23-11-1991, 24-11-1991, 25-11-1991, 26-11-1991, 27-11-1991, 28-11-1991, 30-11-1991, 01-12-1991, 02-12-1991, 09-12-1991, 10-12-1991, 13-12-1991, 14-12-1991, 15-12-1991, 16-12-1991, 17-12-1991, 18-12-1991, 20-12-1991, 23-12-1991, 24-12-1991, 25-12-1991, 26-12-1991, 27-12-1991, 28-12-1991, 31-12-1991, 01-01-1992, 02-01-1992, 09-01-1992, 10-01-1992, 11-01-1992, 12-01-1992, 19-01-1992, 20-01-1992, 21-01-1992, 22-01-1992, 29-01-1992, 01-02-1992, 02-02-1992]
天/月不带前导0:
[20-11-1991, 23-11-1991, 24-11-1991, 25-11-1991, 26-11-1991, 27-11-1991, 28-11-1991, 30-11-1991, 3-12-1991, 4-12-1991, 5-12-1991, 6-12-1991, 7-12-1991, 8-12-1991, 10-12-1991, 13-12-1991, 14-12-1991, 15-12-1991, 16-12-1991, 17-12-1991, 18-12-1991, 20-12-1991, 23-12-1991, 24-12-1991, 25-12-1991, 26-12-1991, 27-12-1991, 28-12-1991, 31-12-1991, 3-1-1992, 4-1-1992, 5-1-1992, 6-1-1992, 7-1-1992, 8-1-1992, 10-1-1992, 13-1-1992, 14-1-1992, 15-1-1992, 16-1-1992, 17-1-1992, 18-1-1992, 20-1-1992, 23-1-1992, 24-1-1992, 25-1-1992, 26-1-1992, 27-1-1992, 28-1-1992, 31-1-1992]
挑战规则:
- 输入和输出日期可以采用任何合理的(日期格式)格式。可以是任何
dMy
格式的字符串(包括可选的分隔符),三个整数的列表,语言的本机Date对象等。输出可以是列表/数组/流,打印到STDOUT,单个定界的String等。 - 您可以在输出中的天/月中包括或排除前导0。请指定您在答案中使用哪两个,因为这会导致不同的结果。即
1-1-1991
具有2个唯一数字,但01-01-1991
作为3个唯一数字。 - 您不必处理leap年和公历与儒略历之间的差异。您可以假设测试用例中给出的日期范围永远不会超过2月28日/ 3月1日,并且可以被4整除。
- 输入数字保证在范围内,因此未指定处理(返回空列表是最合理的选择,但给出错误或不正确的结果也可以;您赢了不必处理这些输入)。
通用规则:
- 这是代码高尔夫球,因此最短答案以字节为单位。
不要让代码高尔夫球语言阻止您使用非代码高尔夫球语言发布答案。尝试针对“任何”编程语言提出尽可能简短的答案。 - 标准规则适用于具有默认I / O规则的答案,因此允许您使用STDIN / STDOUT,具有正确参数的函数/方法以及返回类型的完整程序。你的来电。
- 默认漏洞是禁止的。
- 如果可能的话,请添加一个带有测试代码的链接(即TIO)。
- 另外,强烈建议为您的答案添加说明。
测试用例:
Inputs: [12-11-1991, 02-02-1992], 4
Outputs with leading 0s: [20-11-1991, 23-11-1991, 24-11-1991, 25-11-1991, 26-11-1991, 27-11-1991, 28-11-1991, 30-11-1991, 01-12-1991, 02-12-1991, 09-12-1991, 10-12-1991, 13-12-1991, 14-12-1991, 15-12-1991, 16-12-1991, 17-12-1991, 18-12-1991, 20-12-1991, 23-12-1991, 24-12-1991, 25-12-1991, 26-12-1991, 27-12-1991, 28-12-1991, 31-12-1991, 01-01-1992, 02-01-1992, 09-01-1992, 10-01-1992, 11-01-1992, 12-01-1992, 19-01-1992, 20-01-1992, 21-01-1992, 22-01-1992, 29-01-1992, 01-02-1992, 02-02-1992]
Outputs without leading 0s: [20-11-1991, 23-11-1991, 24-11-1991, 25-11-1991, 26-11-1991, 27-11-1991, 28-11-1991, 30-11-1991, 3-12-1991, 4-12-1991, 5-12-1991, 6-12-1991, 7-12-1991, 8-12-1991, 10-12-1991, 13-12-1991, 14-12-1991, 15-12-1991, 16-12-1991, 17-12-1991, 18-12-1991, 20-12-1991, 23-12-1991, 24-12-1991, 25-12-1991, 26-12-1991, 27-12-1991, 28-12-1991, 31-12-1991, 3-1-1992, 4-1-1992, 5-1-1992, 6-1-1992, 7-1-1992, 8-1-1992, 10-1-1992, 13-1-1992, 14-1-1992, 15-1-1992, 16-1-1992, 17-1-1992, 18-1-1992, 20-1-1992, 23-1-1992, 24-1-1992, 25-1-1992, 26-1-1992, 27-1-1992, 28-1-1992, 31-1-1992]
Inputs: [19-09-2019, 30-09-2019], 5
Outputs (same with and without leading 0s): [23-09-2019, 24-09-2019, 25-09-2019, 26-09-2019, 27-09-2019, 28-09-2019, 30-09-2019]
Inputs: [19-09-2019, 30-09-2019], 8
Output (same with and without leading 0s): []
Inputs: [20-06-1749, 30-06-1749], 8
Outputs with leading 0s: [23-06-1749, 25-06-1749, 28-06-1749]
Outputs without leading 0s: []
Inputs: [10-12-1969, 12-01-1970], 6
Outputs (same with and without leading 0s): [30-12-1969]
Inputs: [10-12-1969, 12-01-1970], 5
Outputs with leading 0s: [10-12-1969, 13-12-1969, 14-12-1969, 15-12-1969, 17-12-1969, 18-12-1969, 20-12-1969, 23-12-1969, 24-12-1969, 25-12-1969, 27-12-1969, 28-12-1969, 31-12-1969, 02-01-1970, 03-01-1970, 04-01-1970, 05-01-1970, 06-01-1970, 08-01-1970, 12-01-1970]
Outputs without leading 0s: [10-12-1969, 13-12-1969, 14-12-1969, 15-12-1969, 17-12-1969, 18-12-1969, 20-12-1969, 23-12-1969, 24-12-1969, 25-12-1969, 27-12-1969, 28-12-1969, 31-12-1969, 2-1-1970, 3-1-1970, 4-1-1970, 5-1-1970, 6-1-1970, 8-1-1970, 12-1-1970]
Inputs: [11-11-1111, 11-11-1111], 1
Output (same with and without leading 0s): [11-11-1111]
YYYY-MM-DDThh:mm:ss.mmm +hh:mm
,+ hh:mm是您的语言环境相对于UTC的时间偏移。)