알고리즘/백준

백준 2753번

반딧불이 코딩 2022. 8. 13. 04:37

#오류 코드

year = int(input())

if year / 4 == 0:
    print("1")
else if year / 100 == 0:
    print("0")
else if year / 400 == 0:
    print("1")

 

#정답 코드

a = int(input())
if (a % 4 == 0 and a % 100 != 0) or a % 400 == 0:
    print(1)
else:
    print(0)

나머지가 0인 것을 구해야 하는데 생각은 제대로 했는데 나누기를 하는 실수를 했다.

'알고리즘 > 백준' 카테고리의 다른 글

백준 2884번  (0) 2022.08.13
백준 14681번  (0) 2022.08.13
백준 3003번  (0) 2022.08.12
백준 9498번  (0) 2022.07.27
백준 1330번  (0) 2022.07.27