๐ŸŒฑ → ๐ŸŒณ

[๋ฐฑ์ค€] 5622๋ฒˆ: ๋‹ค์ด์–ผ python ๋ณธ๋ฌธ

Algorithms

[๋ฐฑ์ค€] 5622๋ฒˆ: ๋‹ค์ด์–ผ python

BAY 2022. 7. 15. 17:45
728x90

https://www.acmicpc.net/problem/5622

 

5622๋ฒˆ: ๋‹ค์ด์–ผ

์ฒซ์งธ ์ค„์— ์•ŒํŒŒ๋ฒณ ๋Œ€๋ฌธ์ž๋กœ ์ด๋ฃจ์–ด์ง„ ๋‹จ์–ด๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๋‹จ์–ด์˜ ๊ธธ์ด๋Š” 2๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 15๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™๋‹ค.

www.acmicpc.net

 

์ •๋‹ต ์ฝ”๋“œ:

dial = ['ABC','DEF','GHI','JKL','MNO','PQRS','TUV','WXYZ']
word = input()
time = 0 
for i in word:
  for j in dial:
    if i in j:
      time += dial.index(j)+3
print(time)

 

dial = ['ABC','DEF','GHI','JKL','MNO','PQRS','TUV','WXYZ']

์ด๋ ‡๊ฒŒ ๋˜์–ด์žˆ์œผ๋ฉด 'ABC'๋ฅผ ํ•œ ๋ฉ์–ด๋ฆฌ(๋‹จ์–ด)๋กœ ์ƒ๊ฐํ•ด์„œ A์™€ ๋น„๊ตํ•˜๊ฑฐ๋‚˜ ์ด๋ ‡๊ฒŒ๋Š” ๋ถˆ๊ฐ€๋Šฅ ํ•œ ์ค„ ์•Œ์•˜๋Š”๋ฐ 

๊ฐ€๋Šฅํ•˜๊ตฌ๋‚˜ 

 

 

728x90