문제
2753번: 윤년
연도가 주어졌을 때, 윤년이면 1, 아니면 0을 출력하는 프로그램을 작성하시오. 윤년은 연도가 4의 배수이면서, 100의 배수가 아닐 때 또는 400의 배수일 때이다. 예를 들어, 2012년은 4의 배수이면서
www.acmicpc.net
정답
let fs = require("fs");
let filePath = process.platform === "linux" ? "/dev/stdin" : "test.txt";
let input = Number(fs.readFileSync(filePath).toString());
if ((input % 4 === 0 && input % 100 >= 1) || input % 400 === 0) {
console.log("1");
} else {
console.log("0");
}