(1).백준 4581번 Voting은 투표 결과를 출력해야 하는 문제였는데
일반적인 것과 다르게 여긴 기권, 불참이 있었고
정족수 체크를 먼저 한 다음 기권은 무시하고 투표 결과를 공개해야 했기 때문에
정족수 체크, 찬성/반대 비교 순서로 진행해서 결과를 출력했다.
const input = `YNNAPYYNY
YAYAYAYA
PYPPNNYA
YNNAA
NYAAA
#`.split('\n')
for(let i = 0 ; i < input.length -1 ; i++){
const member = input[i].length
const abs = input[i].split('').filter(el => el == 'A').length
const yes = input[i].split('').filter(el => el == 'Y').length
const no = input[i].split('').filter(el => el == 'N').length
if((member / 2) <= abs){
console.log('need quorum')
}
else if(yes > no){
console.log('yes')
}
else if(yes < no){
console.log('no')
}
else{
console.log('tie')
}
}'회고' 카테고리의 다른 글
| [개발일지] - 929 (0) | 2026.01.30 |
|---|---|
| [개발일지] - 928 (0) | 2026.01.29 |
| [개발일지] - 927 (0) | 2026.01.28 |
| [개발일지] - 926 (0) | 2026.01.27 |
| [개발일지] - 925(주말) (0) | 2026.01.26 |
