题解 | #计算日期到天数转换#

计算日期到天数转换

https://www.nowcoder.com/practice/769d45d455fe40b385ba32f97e7bcded

a = input().split()

date = int(a[2])

b = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

if int(a[0]) % 4 == 0 and int(a[0]) % 100 != 0 or int(a[0]) % 400 == 0:

    if int(a[1]) > 2 :

        for i in range(int(a[1])):

            date = date + b[i]

        date = date + 1

    else:

        for i in range(int(a[1])):

            date = date + b[i]

else:

    for i in range(int(a[1])):

            date = date + b[i]

print(date)

全部评论

相关推荐

点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务