Description
Input
Output
Sample Input
Sample Output
Hint
We call year Y a leap year only if (Y%4==0 && Y%100!=0) or Y%400==0.
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main() { #ifdef CDZSC_OFFLINE freopen("in.txt","r",stdin); #endif int year,t,n,sum; scanf("%d",&t); while(t--) { sum=0; scanf("%d%d",&year,&n); while(sum<n) { if((year%4==0&&year%100!=0)||(year%400==0)) { sum++; } year++; } printf("%d\n",year-1); } return 0; }
原文:http://www.cnblogs.com/Wing0624/p/4243836.html