import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int k = scanner.nextInt();
for(int i = 0;i<k;i++){
int y = scanner.nextInt();
int n = scanner.nextInt();
int cont = 0;
if(isLeap(y)){
cont = 1;
}
int yy = y;
while(cont != n){
yy++;
if(isLeap(yy)){
cont++;
}
}
System.out.println(yy);
}
}
static boolean isLeap(int yy){
if((yy%4 == 0 && yy%100!=0 )|| yy%400 ==0)
return true;
return false;
}
}
自己的代码,各位大神有没有更简化的代码
[hdoj试题]An Easy Task
最新推荐文章于 2020-02-12 14:43:20 发布