-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[동적계획법] 4월 2일 #7
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "07_\uB3D9\uC801\uACC4\uD68D\uBC95"
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[동적계획법 구현 코드리뷰 완료]
20923(P3)
지운님 안녕하세요! 추가제출 확인 완료되었습니다👍 수고하셨습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
11053(P3), 2579(P3)
안녕하세요 정아님! 코드 리뷰 완료되었습니다👍
함수 분리, 명확한 네이밍 너무 좋았습니다!
문제 해결에 필요한 dp 점화식도 너무 잘 찾아주셨습니다!!
몇 가지 사소한 코멘트 남겼습니다.
궁금하신 점이 있다면 리뷰어를 호출해주세요!
07_동적계획법/라이브코딩/10870.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 라이브 코딩 파일까지 올려주시다니 너무 대단하십니다!! 최고~!
|
||
vector<int>arr; | ||
|
||
int lis(int n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 함수 분리, 명확한 함수 네이밍 너무 좋네요!
for (int i = 0; i < n; i++) { | ||
for (int j = 0; j < i; j++) { | ||
if (arr[j] < arr[i]) { | ||
dp[i] = max(dp[j] + 1, dp[i]); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 증가하는 부분 수열 조건을 잘 찾아주셨네요!!
for (int i = 0; i < n; i++) { | ||
if (len < dp[i]) { | ||
len = dp[i]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: max_element를 이용하여 함수 길이를 줄이는 방법도 추천드립니다!
|
||
vector<int>score; | ||
|
||
int findMax(int n) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 함수 분리, 명확한 함수 네이밍 너무 좋습니다~~
dp[0] = score[0]; | ||
dp[1] = score[0] + score[1]; | ||
dp[2] = max(score[0] + score[2], score[1] + score[2]); //1+3, 2+3 되는데 2+3 처음에 생각 못함! | ||
|
||
for (int i = 3; i < n; i++) { | ||
dp[i] = max(dp[i - 2] + score[i], dp[i - 3] + score[i - 1] + score[i]); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3: 계단오르기 점화식 조건을 잘 찾아주셨네요!! dp는 점화식을 세우면 반은 끝나는 것 같습니다ㅎㅎ
인적사항
학번: 2276209
이름: 윤지운
과제제출
기존 제출: 2579, 11053
추가 제출: 20923