https://www.acmicpc.net/problem/2753


풀이
year = int(input())

if year%400==0:
  print(1)
elif year%4==0 and not year%100==0:
  print(1)
else:
  print(0)

> 윤년이 되는 조건에 대해 잘 생각해 보아야 한다.

 우선, 400의 배수인 해는 무조건적으로 윤년이므로 우선적으로 걸러낸다.

 그 후, 4의 배수이며 100의 배수가 아닌 해를 윤년으로 걸러낸다.

 나머지는 평년이다.

+ Recent posts