2020年第十一届蓝桥杯 - 省赛 - Python大学组 - C.跑步锻炼

2020年第十一届蓝桥杯 - 省赛 - Python大学组 - C.跑步锻炼,第1张

2020年第十一届蓝桥杯 - 省赛 - Python大学组 - C.跑步锻炼

Ideas

Python日期计算,判断周初月初就欧克啦。

Code Python
from datetime import date
from datetime import timedelta

if __name__ == '__main__':
	start = date(2000, 1, 1)
	end = date(2020, 10, 2)

	res = 0
	while start < end:
		res += 2 if start.day == 1 or start.weekday() == 0 else 1
		start += timedelta(days=1)
	print(res)
Answer:8879

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5700954.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存