hdu 1076 An Easy Task

http://acm.hdu.edu.cn/showproblem.php?pid=1076 

View Code
 1 #include<iostream>
2 using namespace std;
3 bool isleap(int year)
4 {
5 if(year%4==0 && year%100!=0) return true;
6 if(year%400==0) return true;
7 return false;
8 }
9 int main()
10 {
11 int t,year,num;
12 cin>>t;
13 while(t--)
14 {
15 cin>>year>>num;
16 int count=0;
17 while(true)
18 {
19 if(isleap(year)) count++;
20 if(count==num) break;
21 year++;
22 }
23 cout<<year<<endl;
24 }
25 return 0;
26 }


 

posted @ 2012-04-02 20:38  keepmoving89  阅读(130)  评论(0编辑  收藏  举报