| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 132311 | 胡海峰老师 | 今年的第几天 | Python3 | Accepted | 51 MS | 3780 KB | 798 | 2025-10-07 20:02:44 |
def day_of_year(year, month, day): # 每个月的天数(非闰年) days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 判断是否为闰年 def is_leap_year(y): return (y % 4 == 0 and y % 100 != 0) or (y % 400 == 0) # 如果是闰年,2月有29天 if is_leap_year(year): days_in_month[1] = 29 else: days_in_month[1] = 28 # 计算天数 total_days = 0 # 累加前几个月的天数 for i in range(month - 1): total_days += days_in_month[i] # 加上当前月的天数 total_days += day return total_days # 读取输入 year, month, day = map(int, input().split()) # 计算并输出结果 result = day_of_year(year, month, day) print(result)