提交时间:2026-02-01 10:19:36
运行 ID: 377500
import java.util.Scanner; // 强制主类名Main,在线测评必备 public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); // 读取测试用例组数t // 循环t次,处理每个年份 for (int i = 0; i < t; i++) { int year = sc.nextInt(); // 读取待判断的年份 // 核心:闰年判断条件,按规则写逻辑表达式 if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) { System.out.println("Yes"); // 是闰年输出Yes(注意大小写,严格匹配样例) } else { System.out.println("No"); // 不是闰年输出No } } sc.close(); } }