OJ-Problems-Source/HDOJ/1076_autoAC.cpp

32 lines
492 B
C++
Raw Normal View History

2016-08-12 10:16:59 +08:00
#include <stdio.h>
int leapyear(int Y)
{
if((Y%4==0 && Y%100!=0) || (Y%400==0))
return 1;
else
return 0;
}
int main()
{
int Y,N,n,count;
scanf("%d",&n);
while(n--)
{
count=0;
scanf("%d%d",&Y,&N);
while(count<N)
{
if(leapyear(Y))
{
count++;
Y++;
}
else
{
Y++;
}
}
printf("%d\n",Y-1);
}
}