原题链接:https://www.luogu.com.cn/problem/P5711


题目描述

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

输入格式

输出格式

输入输出样例

输入 #1

1926

输出 #1

0

输入 #2

1900

输出 #2

0

输入 #3

2000

输出 #3

1

输入 #4

1996

输出 #4

1

C++代码

#include <iostream>
using namespace std;

int main() {
    int year;
    cin >> year;
    if (year % 100!=0 && year % 4 == 0 || year % 400 == 0)
        cout << 1 << endl;
    else
        cout << 0 << endl;
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
猜你喜欢
  • 2021-05-30
  • 2021-11-01
  • 2022-03-03
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
相关资源
相似解决方案