import sys def is_leap_year(year): """判断是否为闰年""" return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) def day_of_year(year, month, day): """计算某天是该年的第几天""" # 每月的天数,2月暂按28天处理(后面根据闰年调整) month_days = [31, 28, 31, 30, 31, 30, 31, 31, ...