#include<cstdio>
#include<iostream>
bool isleap(int x){
return (x%4 == 0 && x%100 !=0) || x%400 == 0;
}
int main(void){
int t;
scanf("%d",&t);
while(t--){
int n,m,count=0;;
scanf("%d%d",&n,&m);
while(1){
if(isleap(n)){
count++;
if(count == m){
printf("%d\n",n);
break;
}
}
n+=4-(n%4);
}
}
return 0;
}
hdu 1076 水
最新推荐文章于 2019-03-18 20:48:45 发布