Skip to content

Commit

Permalink
2024-04-14 컨트롤 제트
Browse files Browse the repository at this point in the history
  • Loading branch information
suhyun113 committed Apr 15, 2024
1 parent 034ac61 commit 18ce7d3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
| 2차시 | 2024.03.29 | 수학 | [소수 & 팰린드롬](https://www.acmicpc.net/problem/1747) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) |
| 3차시 | 2024.04.02 | 그리디 | [거스름돈](https://www.acmicpc.net/problem/14916) | [#12](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/12) |
| 4차시 | 2024.04.06 | DP | [피보나치 수 5](https://www.acmicpc.net/problem/10870) | [#16](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/16) |
| 5차시 | 2024.04.10 | 스택 | [크레인 인형 뽑기 게임](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) |
| 5차시 | 2024.04.10 | 스택 | [크레인 인형 뽑기 게임](https://school.programmers.co.kr/learn/courses/30/lessons/64061) | [#19](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/19) |
| 6차시 | 2024.04.14 | 스택 | [컨트롤 제트](https://school.programmers.co.kr/learn/courses/30/lessons/120853) | [#21](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/21) |
20 changes: 20 additions & 0 deletions suhyun113/스택/6-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def solution(s):
answer = 0

stack = [float("inf")]

# 문자열을 공백 기준으로 나누어 리스트에 저장
s_list = s.split()

for i in s_list: # i는 s_list의 인덱스가 아닌 값
if i != 'Z':
stack.append(i)
else:
stack.pop() # stack의 가장 위의 값 빼기
stack.pop(0)

# 문자를 정수로 변환하기
for i in stack:
n = int(i)
answer += n
return answer

0 comments on commit 18ce7d3

Please sign in to comment.