Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- 파이썬
- dacon
- Kaggle
- Git
- ubuntu
- 백준
- programmers
- 우분투
- Real or Not? NLP with Disaster Tweets
- PYTHON
- Docker
- 프로그래머스 파이썬
- 맥북
- github
- 캐치카페
- SW Expert Academy
- 자연어처리
- 편스토랑
- 코로나19
- 금융문자분석경진대회
- 데이콘
- hackerrank
- leetcode
- 프로그래머스
- Baekjoon
- ChatGPT
- 더현대서울 맛집
- gs25
- 편스토랑 우승상품
- AI 경진대회
Archives
- Today
- Total
솜씨좋은장씨
[Programmers] 2018 KAKAO BLIND RECRUITMENT [1차] 다트 게임 (Python) 본문
Programming/코딩 1일 1문제
[Programmers] 2018 KAKAO BLIND RECRUITMENT [1차] 다트 게임 (Python)
솜씨좋은장씨 2022. 2. 17. 02:49728x90
반응형
코딩 1일 1문제! 오늘의 문제는 프로그래머스의 2018 KAKAO BLIND RECRUITMENT [1차] 다트 게임 입니다.
👨🏻💻 코드 ( Solution )
def solution(dartResult):
temp_list = []
temp = ""
idx = -1
for dart in dartResult:
if dart == "S":
temp_list.append(pow(int(temp), 1))
temp = ""
idx += 1
elif dart == "D":
temp_list.append(pow(int(temp), 2))
temp = ""
idx += 1
elif dart == "T":
temp_list.append(pow(int(temp), 3))
temp = ""
idx += 1
elif dart == "*":
if idx < 1:
temp_list[idx] = temp_list[idx] * 2
else:
temp_list[idx] = temp_list[idx] * 2
temp_list[idx-1] = temp_list[idx-1] * 2
elif dart == "#":
temp_list[idx] = temp_list[idx] * -1
else:
temp += dart
return sum(temp_list)
'Programming > 코딩 1일 1문제' 카테고리의 다른 글
[Programmers] 피보나치 수 (Python) (0) | 2022.02.19 |
---|---|
[Programmers] 월간 코드 챌린지 시즌3 - n^2 배열 자르기 (Python) (0) | 2022.02.18 |
[Programmers] 찾아라 프로그래밍 마에스터 - 폰켓몬 (Python) (0) | 2022.02.16 |
[Programmers] 탐욕법(Greedy) - 체육복 (Python) (0) | 2022.02.15 |
[Programmers] 2019 카카오 개발자 겨울 인턴십 - 크레인 인형뽑기 게임 (Python) (0) | 2022.02.14 |
Comments