Merged
Conversation
This file contains hidden or 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 characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/1027
🧭 풀이 시간
30분+
👀 체감 난이도
✏️ 문제 설명
(i,0)부터 (i,높이)의 선분으로 이루어진 빌딩들이 있을 때 한 빌딩의 옥상에서 다른 빌딩을 볼 수 있는 최대의 경우의 수를 구하는 문제입니다
🔍 풀이 방법
각 빌딩에서 다른 빌딩까지의 왼쪽, 오른쪽의 기울기를 각각 계산하여 횟수를 세었습니다.
왼쪽의 경우 기울기가 이전 기울기보다 작아지면 볼 수 있는 경우
오른쪽의 경우 기울기가 이전 기울기보다 커지면 볼 수 있는 경우이기 때문에
위 규칙을 이용했습니다.
⏳ 회고
문제의 접근 자체는 쉽게 했으나 기초적인 기울기 계산에서 int 자료형을 사용한 것을 깨닫지 못해서 통과할 때 까지 시간이 오래 걸렸습니다.
특정상황 (나눗셈) 에서의 자료형 사용에 유의해야 할 것 같습니다.