题解 | 计算日期到天数转换
计算日期到天数转换
https://www.nowcoder.com/practice/769d45d455fe40b385ba32f97e7bcded
while True: try: y, m, d = list(map(int, input().split())) feb = 28 if (y % 4 == 0 and y % 100 != 0) or y % 400 == 0: feb = 29 std = {2: feb} month = (1, 3, 5, 7, 8, 10, 12) for i in range(1, 13): if i in month: std[i] = 31 elif i != 2: std[i] = 30 result = d for i in range(1, m): result += std[i] print(result) except: break