문제가 번역이 되어 있지 않아 쫄았지만
세상 쉬운 문제였다
코딩 자체보다 영어 독해력을 묻는 문제가 아니었는가 싶을 정도...
https://www.acmicpc.net/problem/15233
15233번: Final Score
We have had a problem with one of our hard disks and we lost the final score of some football matches. However, we have been able to recover the names of the players that scored and found the members of each team on Wikipedia.
www.acmicpc.net
let input = [];
const readline = require("readline").createInterface({
input: process.stdin,
output: process.stdout,
});
readline.on("line", (line) => {
input.push(line);
});
readline.on("close", () => {
solution(input);
process.exit();
});
const solution = (inp) => {
inp.shift();
let amem = inp.shift().split(" ");
let bmem = inp.shift().split(" ");
let scoremem = inp.shift().split(" ");
let ascore = 0;
let bscore = 0;
let ans;
for (el of scoremem) {
for (a of amem) {
if (el === a) {
ascore++;
}
}
for (b of bmem) {
if (el === b) {
bscore++;
}
}
}
if (ascore > bscore) {
ans = "A";
} else if (ascore < bscore) {
ans = "B";
} else {
ans = "TIE";
}
console.log(ans);
};
'개발 노트 > 백준, 프로그래머스 풀이' 카테고리의 다른 글
[백준 14490/javascript] 백대열 (0) | 2022.09.13 |
---|---|
[백준 1822/javascript] 차집합 (0) | 2022.09.12 |
[백준 25192/javascript] 인사성 밝은 곰곰이 (0) | 2022.09.10 |
[백준 25325/javascript] 학생 인기도 측정 (0) | 2022.09.09 |
[백준 13915/javascript] 현수의 열기구 교실 (0) | 2022.09.09 |
댓글