| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 67195 | 陆宥呈 | 闰年的数量 | Python3 | Accepted | 33 MS | 3780 KB | 531 | 2024-03-15 18:37:59 |
def isLeapYear(y): if y % 400 == 0: return True elif y % 4 == 0 and y % 100 != 0: return True else: return False """ 返回True:是闰年,返回False:是平年 如果y年份是400的倍数,判定为闰年; 如果y年份是4的倍数且不是100的倍数,也判定为闰年; 上面2种情况不成立,则为平年 """ 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)