文章
2
粉丝
160
获赞
0
访问
18.3k
题号:1542
代码:
def leapYear(y):
m1 = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
m2 = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if ((y % 4 == 0 and y % 100 != 0) or y % 400 == 0):
return m2
else:
return m1
d = list(map(int, input().split('-')))
m = leapYear(d[0])
date = 0
for i in range(d[1] - 1):
date += m[i]
date += d[2]
print(date)
登录后发布评论
我把闰年和平年弄反了,尴尬
http://www.noobdream.com/post/774/、可以根据这个方法排查一下错误哦