传送门:HDU 1076
#include <iostream>
#include <cstdio>
using namespace std;
int leadyear(int y)
{
while(1)
{
if(y%400 == 0 || ( y%100!=0 && y%4 == 0 ))
{
return y;
}
y++;
}
}
int main()
{
int n;
int start;
int mrank;
scanf("%d",&n);
while(n--)
{
scanf("%d%d",&start,&mrank);
int result = leadyear(start);
for(int i=1;i<mrank;i++)
{
result++;
result = leadyear(result);
}
printf("%d\n",result);
}
return 0;
}