[20250213] BOJ / 골드4 / 연산자 끼워넣기 / 이강현 #114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/15659
🧭 풀이 시간
120분
👀 체감 난이도
✏️ 문제 설명
순서가 정해져 있는 N개의 수 사이에 입력으로 주어진 N-1 개의 연산자를 끼워넣었을 때 최댓값과 최솟값을 구하는 문제
🔍 풀이 방법
백트래킹을 이용해서 수식이 만들어지는 모든 경우의 수를 구하고 이를 계산한다. 스택을 이용하여 연산자 우선순위를 고려한다.
⏳ 회고
문제 자체는 크게 어렵진 않은 거 같은데 연산자 우선순위가 존재해서 중간 중간 스택을 잘 이용해서 수식을 최적화 해야 했는데 지금 타이밍에서 앞에서 빼야하는지 뒤에서 빼야하는지가 자꾸 헷갈려서 오래 걸렸다....