BJ-16968-차량 번호판1

이은지·2023년 1월 17일
0

코딩테스트

목록 보기
73/76

문제
https://www.acmicpc.net/problem/16968

풀이

const input = require('fs').readFileSync('./dev/stdin').toString().trim().split('\n').map(v=>v.trim())[0]
const answer = [];

if(input[0]=='d'){
  answer.push(10)
} else{
  answer.push(26)
}

for(let i = 1; i<input.length; i++){
  let temp;
  if(input[i]=='d'){
    temp = 10
  }else{
    temp = 26
  }
  if(input[i]==input[i-1]){
    temp--;
  }
  answer.push(temp)
}

console.log(answer.reduce((r,v)=>{
  return r*v
},1))

0개의 댓글