python如何判断是否是闰年 闰年共有366天 2月份多一天29天
python如何判断是否是闰年
def isRunYear(year):
if (year % 100 == 0 and year % 400 == 0) or (year % 100 != 0 and year % 4 == 0):
return True
else:
return False
year, month, day = map(int, input().split())
dic = {}
dic[1] = 31
dic[3] = 31
dic[5] = 31
dic[7] = 31
dic[8] = 31
dic[10] = 31
dic[12] = 31
dic[4] = 30
dic[6] = 30
dic[9] = 30
dic[11] = 30
if isRunYear(year):
dic[2] = 29
else:
dic[2] = 28
ans = 0
for i in range(1,month):
ans += dic[i]
ans += day
print(ans)