题解 | 计算日期到天数转换
计算日期到天数转换
https://www.nowcoder.com/practice/769d45d455fe40b385ba32f97e7bcded
import sys
a, b, c = map(int, input().split())
total = 0
runyear_day = [31,29,31,30,31,30,31,31,30,31,30,31]
pingyear_day = [31,28,31,30,31,30,31,31,30,31,30,31]
if (a % 4 == 0 and a % 100 != 0) or a % 400 == 0:
for i in range(b-1):
total += runyear_day[i]
total += c
else:
for k in range(b-1):
total += pingyear_day[k]
total += c
print(total)
查看16道真题和解析