본문 바로가기

BAEKJOON/JavaScript

[BAEKJOON] 음계 (2920번)

const input  = require("fs").readFileSync("/dev/stdin").toString().split("\n");

function checkTheScale(input) {
    let scale      = Number(input.join(""));
    let ascending  = 12345678;
    let descending = 87654321;

    if(scale === ascending ) {
        console.log("ascending");
    } else if (scale === descending) {
        console.log("descending");
    } else {
        console.log("mixed");
    }
}

checkTheScale(input);

'BAEKJOON > JavaScript' 카테고리의 다른 글

[BAEKJOON] OX퀴즈 (8958번)  (0) 2022.03.18
[BAEKJOON] 문자열 반복 (2675번)  (0) 2022.03.18
[BAEKJOON] 최댓값 (2562번)  (0) 2022.03.18
[BAEKJOON] We love kriii (10718번)  (0) 2022.01.20
[BAEKJOON] Hello World (2557번)  (0) 2022.01.20