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;
}
}
自己的代码,各位大神有没有更简化的代码
07-13
07-13
07-13
07-13
05-28
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交