본문 바로가기
Development/코딩테스트

[백준] 2754 Node.js

by Yeony99 2022. 9. 17.
728x90
const fs = require('fs');
const input = fs.readFileSync("/dev/stdin").toString().trim();

if(input.charAt(0) === 'A') {
    score = 4;
} else if(input.charAt(0) === 'B') {
    score = 3;
} else if(input.charAt(0) === 'C') {
    score = 2;
} else if(input.charAt(0) === 'D') {
    score = 1;
} else score = 0;

if(input.charAt(1) === '+') {
    score+= 0.3
} else if(input.charAt(1) === '-') {
    score -= 0.3
}

console.log(score.toFixed(1))
728x90

'Development > 코딩테스트' 카테고리의 다른 글

[백준] 1271 Node.js  (0) 2022.09.19
[백준] 2475 Node.js  (0) 2022.09.18
[백준] 9086 Node.js  (0) 2022.09.16
[백준] 2440 Node.js  (0) 2022.09.16
[백준] 4101 Node.js  (0) 2022.09.15

댓글