꾸준히 합시다

백준 파이썬 11784번: Hex Code 본문

코딩 테스트 문제 풀이

백준 파이썬 11784번: Hex Code

tturbo0824 2021. 7. 9. 12:22

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

 

11784번: Hex Code

In the movie The Martian (2015), astronaut Mark Watney, one of the crew members of Mission Ares III, was left behind on Mars due to an unexpected incident during the surface exploration on the planet Mars. The communication with Earth was quasi-inexistent.

www.acmicpc.net

문제 유형: 구현

 

 

# Solution 1

while True:
    try:
        s = input()
        print(bytearray.fromhex(s).decode())

    except EOFError:
        break

try, except를 사용해 예외처리를 해주지 않으면 런타임 에러 (EOFError)가 발생해 테스트를 통과하지 못하게 된다.

Comments