Problem : 闰年闰月

Problem E: 闰年闰月

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 3341  Solved: 1546

Description

 输入1个年月 如果年份是闰年,月份也符合闰年规则,即认为是闰年闰月

Input

先输入一个整数t,表示有t组测试数据,然后是t行,每行输入2个整数用空格隔开,分别代表年和月

Output

 对于每组数据输出1行,如果是闰年闰月则输出yes否则输出no

Sample Input

2
2008 8
2008 2

Sample Output

yes
no

HINT


就是把年的判断加一个在月上


代码:

#include
int main(void)
{
    int t,i,a,b;
    while(scanf("%d",&t)!=EOF)
    {
        for(i=0;i         {
            scanf("%d%d", &a, &b);
            if(a%4==0&&a%100!=0||a%400==0)
            {
                if(b%4==0&&b%100!=0||b%400==0)
                printf("yes\n");
                else
                printf("no\n");
            }
            else 
            printf("no\n");
        }
    }
return 0;    
}

你可能感兴趣的:(C语言入门题)