-
[백준] 1076 - 저항 (python)Problem Solving/Python 2023. 7. 10. 09:38반응형
1076번: 저항
전자 제품에는 저항이 들어간다. 저항은 색 3개를 이용해서 그 저항이 몇 옴인지 나타낸다. 처음 색 2개는 저항의 값이고, 마지막 색은 곱해야 하는 값이다. 저항의 값은 다음 표를 이용해서 구한
www.acmicpc.net
포인트
주어진 대로 Dictionary에 저장해놓고 구현하면 되는데 10을 값 만큼 제곱하면 곱이 되길래 나는 색과 값만 매칭 시킨 뒤 풀었다
코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersvalue_dict = {'black' : 0, 'brown': 1, 'red': 2, 'orange': 3, 'yellow': 4, 'green': 5, 'blue': 6, 'violet': 7, 'grey': 8, 'white': 9} a = input() b = input() c = input() answer = str(value_dict[a]) + str(value_dict[b]) answer = int(answer) * (10 ** value_dict[c]) print(answer) 반응형'Problem Solving > Python' 카테고리의 다른 글
[백준] 1094 - 막대기 (재귀 풀이) (python) (0) 2023.07.11 [백준] 1085 - 직사각형에서 탈출 (python) (0) 2023.07.11 [백준] 1075 - 나누기 (python) (0) 2023.07.10 [백준] 1037 - 약수 (python) (0) 2023.07.07 [백준] 1032 - 명령 프롬프트 (python) (0) 2023.07.07