IT/Baekjoon Oline Judge

[BOJ] 2753번 - 윤년

개발자희망생고롸파덕 2023. 8. 15. 18:28

사용언어 : javascript - node.js

 

# 제출 코드

const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
let input = fs.readFileSync(filePath).toString().trim();

solution(+input);

function solution(input) {
  if (input % 4 === 0 && input % 100 !== 0) {
    console.log('1');
  } else if (input % 400 === 0) {
    console.log('1');
  } else {
    console.log('0');
  }
}