一、原题
问题描述
试题编号:
|
201712-3
|
试题名称:
|
Crontab
|
时间限制:
|
10.0s
|
内存限制:
|
256.0MB
|
问题描述:
|
![clip_image002 clip_image002](https://images2018.cnblogs.com/blog/784124/201808/784124-20180824184140208-1994768555.jpg)
![clip_image004 clip_image004](https://images2018.cnblogs.com/blog/784124/201808/784124-20180824184140962-530497923.jpg) ![clip_image006 clip_image006](https://images2018.cnblogs.com/blog/784124/201808/784124-20180824184141714-1585724018.jpg)
![clip_image008 clip_image008](https://images2018.cnblogs.com/blog/784124/201808/784124-20180824184142348-1860108363.jpg)
样例输入
3 201711170032 201711222352 0 7 * * 1,3-5 get_up 30 23 * * Sat,Sun go_to_bed 15 12,18 * * * have_dinner
样例输出
201711170700 get_up 201711171215 have_dinner 201711171815 have_dinner 201711181215 have_dinner 201711181815 have_dinner 201711182330 go_to_bed 201711191215 have_dinner 201711191815 have_dinner 201711192330 go_to_bed 201711200700 get_up 201711201215 have_dinner 201711201815 have_dinner 201711211215 have_dinner 201711211815 have_dinner 201711220700 get_up 201711221215 have_dinner 201711221815 have_dinner
|
二、题解
首先是输入的起始和截止时间需要存储。这样方便循环后面的具体每条Crontab。每一条用空格分割。然后通过提前定义好的正则替换。但是星期几这个日期替换的时候应该注意是每隔六天就执行一次这个命令。然后根据具体的循环来嵌套循环时间。然后循环起始到结束每天。的执行命令。然后输出即可。
三、代码