游客 Signup | Login
中文 | En

1106 - C语言2.3

输入一个2000至2500年间(包含2000年和2500年)的任意年份,判断是否是闰年。

Input

输入一个整数year,表示年份。输入保证2000≤year≤2500。

Output

如果输入的年份是闰年,请输出“leap year”,否则请输出“not leap year”。

请注意不需要输出引号,行尾输出换行。

Examples

Input

2100

Output

not leap year

Solution C

#include <stdio.h>
void main() {
    int year;
    scanf("%d", &year);
    if (year % 4 == 0) {
        if (year % 100 == 0) {
            if (year % 400 == 0) {
                printf("leap year\n");
            } else {
                printf("not leap year\n");
            }
        } else {
            printf("leap year\n");
        }
    } else {
        printf("not leap year\n");
    }
}

Solution C++

#include<iostream>
using namespace std;
int main()
{
  int input;
  cin >> input;
  if((input%4 == 0 && input%100!=0) || input%400 == 0)
    cout << "leap year" << endl;
  else
    cout << "not leap year" << endl;
  return 0;
}
Time Limit 1 second
Memory Limit 32 MB
Discuss Stats
上一题 下一题