언젠가는 펼쳐 볼 아카이브

[BOJ] 2753번 - 윤년 본문

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');
  }
}

'IT > Baekjoon Oline Judge' 카테고리의 다른 글

[BOJ] 2884 - 알람시계  (0) 2023.08.15
[BOJ] 14681번 - 사분면 고르기  (0) 2023.08.15
[BOJ] 1330번 - 두 수 비교하기  (0) 2023.08.15
[BOJ] 10171번 - 고양이  (0) 2023.08.15
[BOJ] 11382번 - 꼬마 정민  (0) 2023.08.15