You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#include <cstdio>
|
|
using namespace std;
|
|
bool check(int x)
|
|
{
|
|
return (x%100==0)?(x%400==0):(x%4==0);
|
|
}
|
|
int main()
|
|
{
|
|
int t,y,n;
|
|
scanf("%d",&t);
|
|
while(t--)
|
|
{
|
|
scanf("%d%d",&y,&n);
|
|
while(n)
|
|
if(check(y++))
|
|
n--;
|
|
printf("%d\n",y-1);
|
|
}
|
|
return 0;
|
|
}
|