Skip to content

[이분탐색] 11월 5일#9

Open
wonnn25 wants to merge 5 commits intomainfrom
week10
Open

[이분탐색] 11월 5일#9
wonnn25 wants to merge 5 commits intomainfrom
week10

Conversation

@wonnn25
Copy link
Copy Markdown
Collaborator

@wonnn25 wonnn25 commented Nov 5, 2024

##인적사항
학번: 2171060
이름: 김예원

##과제 제출
기존 제출: 17266, 10815, 16401

Copy link
Copy Markdown
Member

@sforseohn sforseohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[이분탐색 이론 문제 코드 리뷰 완료]

16401(P2)

예원님 안녕하세요! 이번 주도 과제하시느라 고생 많으셨습니다.
강의 시간에 배운 개념을 잘 적용해서 풀어주셨네요! 😎

몇 가지 코멘트 드렸습니다.
궁금한 점이 있다면 리뷰어를 호출해주세요!

Comment thread 10_이분탐색/16401.cpp Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2. 맞아요! 이분탐색을 할 때는 탐색할 값들이 반드시 정렬되어 있어야 한다고 했죠. 🤗 그런데 이 문제에서는 가지고 있는 과자들의 길이 자체는 탐색하지 않으며, 이건 순서에 상관없이 주어진 길이로 과자 몇 개를 나눠줄 수 있는지 계산할 때만 사용돼요. 그래서 snack을 따로 정렬해주지 않아도 됩니다!

Comment thread 10_이분탐색/16401.cpp Outdated
Comment on lines 41 to 52
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2. 모든 조카에게 같은 길이의 과자를 나눠줄 수 없는 경우, 탐색의 마지막 leftright값이 어떻게 될지 생각해 볼까요? 과자의 길이를 계속 줄이다가 결국 과자의 길이가 1일 때도 나누어줄 수 없기 때문에, rightmid(1) - 1 = 0이 되고, 이때 left(1) > right(0) 이기 때문에 반복문을 빠져나오겠죠. 즉 이 경우를 따로 분리할 필요 없이 return left - 1;로 처리할 수 있습니다. 😊

Comment thread 10_이분탐색/16401.cpp Outdated
Comment on lines 55 to 76
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메인함수 깔끔하고 좋습니다👍👍👍

Comment thread 10_이분탐색/16401.cpp Outdated
Comment on lines 24 to 25
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매개변수 탐색을 위한 초깃값을 잘 설정해주셨네요 💯

Comment thread 10_이분탐색/16401.cpp Outdated
Comment on lines 28 to 39
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

탐색 부분, 함수화 모두 좋습니다! 💯💯💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants