C 参考代码:
#include <stdio.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
int n;
scanf("%d", &n);
if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {
puts("Yes");
}
else {
puts("No");
}
}
}
C++ 参考代码:
#include <iostream>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {
cout << "Yes\n";
}
else {
cout << "No\n";
}
}
}
Java 参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while (t-- > 0) {
int n = sc.nextInt();
if ((n % 4 == 0 && n % 100 != 0) || n % 400 == 0) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
}
Python 参考代码:
for i in range(int(input())):
n = int(input())
if ((n % 4 == 0 and n % 100 != 0) or n % 400 == 0):
print('Yes')
else:
print('No')