Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
71995 赵天瑜 [在线测评解答教程] 闰年 Python3 Accepted 35 MS 3776 KB 485 2024-04-29 19:29:49

Tests(11/11):


Code:

def is_leap_year(year): # 判断是否为闰年的规则: # 1. 如果年份能被4整除,但不能被100整除,则是闰年; # 2. 如果年份能被400整除,则也是闰年。 return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0) # 输入 t = int(input()) years = [int(input()) for _ in range(t)] # 判断每个年份是否为闰年 for year in years: if is_leap_year(year): print("Yes") else: print("No")