#P5711. 【深基3.例3】闰年判断
【深基3.例3】闰年判断
Leap Year
Problem Source
Luogu P5711
Problem Description
Input a year and determine whether it is a leap year. If it is, output ; otherwise output .
Definition of a leap year since :
- Common leap year: a Gregorian year that is a multiple of but not a multiple of is a leap year (e.g. and are leap years).
- Century leap year: a Gregorian year that is a multiple of must be a multiple of to be a leap year (e.g. is not a leap year, while is a leap year).
Input Format
One positive integer , representing the year.
Output Format
One line. If the input year is a leap year, output ; otherwise output .
Sample Input 1
1926
Sample Output 1
0
Sample Input 2
1900
Sample Output 2
0
Sample Input 3
2000
Sample Output 3
1
Sample Input 4
1996
Sample Output 4
1
Hint
- The leap-year rule is two sentences; write the two conditions down on paper first, then combine them into one with logical operators.
- Each side of
||is a complete condition — do not omit the parentheses, since getting the precedence wrong gives the wrong answer. - Verify with the samples:
1900→0,2000→1.
The data guarantees and that the year is a natural number.