(1).백준 34980번 생수병 놓기는 좌석에 .과 W로 생수병이 놓여져 있는지를 표기했을 때
생수의 위치 변동 및 개수 변동에 따른 값 출력을 해야 하는 문제로
생수의 갯수는 필터링을 통해 처리하고 같은 배치인지 확인은 문자열 자체 비교를 통해 처리했다.
const input = `5
ww...
www..`.split('\n')
const a = input[1].split('').filter(el => el == 'w').length
const b = input[2].split('').filter(el => el == 'w').length
if(a > b){
console.log('Oryang')
}
else if(a < b){
console.log('Manners maketh man')
}
else if(input[1] == input[2]){
console.log('Good')
}
else if(a == b){
console.log('Its fine')
}'회고' 카테고리의 다른 글
| [개발일지] - 948(설날) (0) | 2026.02.18 |
|---|---|
| [개발일지] - 947(설날) (0) | 2026.02.17 |
| [개발일지] - 946(주말) (0) | 2026.02.16 |
| [개발일지] - 945(주말) (0) | 2026.02.15 |
| [개발일지] - 944 (0) | 2026.02.14 |
