| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 67193 | 胡海峰老师 | 闰年的数量 | Python3 | Accepted | 30 MS | 3776 KB | 522 | 2024-03-15 18:36:43 |
def isLeapYear(y): """ 返回True:是闰年,返回False:是平年 如果y年份是400的倍数,判定为闰年; 如果y年份是4的倍数且不是100的倍数,也判定为闰年; 上面2种情况不成立,则为平年 """ if y%400==0: return True elif y%4==0 and y%100 !=0: return True else: return False a,b= input().split() a,b=int(a),int(b) cnt =0 for y in range(a,b+1): if isLeapYear(y): cnt +=1 print(cnt)