P5711 【深基3.例3】闰年判断

题目

描述

输入一个年份(大于 1582 的整数 ),判断这一年是否是闰年,如果是输出 1,否则输出 0。

输入输出样例

输入 输出
2000 1

解答

#include<iostream>

using namespace std;

int a;

int main()
{
    cin>>a;
    if(a%4==0 && (a%100!=0 || a%400==0))
        cout<<1;
    else
        cout<<0;
        
    return 0;
}
posted @ 2021-03-29 16:13  CodeSpark  阅读(96)  评论(0编辑  收藏  举报