An Easy Task

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

   1 /*written by czk*/
   2 #include <stdio.h>
   3 
   4 int isleap(int y) {
   5     return y%400 == 0 || y%4 == 0 && y%100 != 0;
   6 }
   7 
   8 int main() {
   9     int t;
  10     scanf("%d", &t);
  11     while(t--) {
  12         int y, n;
  13         scanf("%d%d", &y, &n);
  14         while(n > 0)
  15             if(isleap(y++))
  16                 n--;
  17         printf("%d\n", y-1);
  18     }
  19 }

hdu1076 (2008-06-01 14:39:59由czk编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.