HDU 1076 An Easy Task
1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int year,y,m,n,count; 6 scanf("%d",&n); 7 while(n--) 8 { 9 count=0; 10 scanf("%d%d",&y,&m); 11 for(year=y;;year++) 12 { 13 if((year%4==0&&year%100!=0)||(year%400)==0) 14 count++; 15 if(m==count) 16 { 17 printf("%d\n",year); 18 break; 19 } 20 } 21 } 22 system("pause"); 23 return 0; 24 } 25