当前位置:编程学习 > C/C++ >>

问题九十四: An Easy Task

 

\

   

  

[plain]
#include <stdio.h> 
 
int main() 

     int y; 
     int n; 
     int num; 
     int count; 
 
     scanf("%d", &num); 
 
     while(num--) 
     {     
          scanf("%d %d", &y, &n); 
 
          count=0; 
           
          do 
          { 
               if( (y%4==0 && y%100!=0 ) || (y%400==0)) 
               { 
                   count++; 
               } 
 
               y++; 
 
          }while(count<= n-1); 
 
          printf("%d", y-1); 
 
          if(num>0) 
          { 
              printf("\n"); 
          } 
     } 
 

#include <stdio.h>

int main()
{
  int y;
  int n;
  int num;
  int count;

  scanf("%d", &num);

  while(num--)
  {   
       scanf("%d %d", &y, &n);

          count=0;
         
    do
    {
         if( (y%4==0 && y%100!=0 ) || (y%400==0))
      {
             count++;
      }

      y++;

    }while(count<= n-1);

    printf("%d", y-1);

    if(num>0)
    {
        printf("\n");
    }
  }

}    


\
补充:软件开发 , C语言 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,