-
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일 #16
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "07_\uB3D9\uC801\uACC4\uD68D\uBC95"
[동적계획법]4월 2일 #16
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 점화식도 너무 잘 찾아주셨습니다!!
몇 가지 사소한 코멘트 남겼습니다.
궁금하신 점이 있다면 리뷰어를 호출해주세요!
|
||
using namespace std; | ||
|
||
int checkLongest(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++){ | ||
int leng=0; | ||
|
||
for(int j=0; j<i; j++){ | ||
if(A[i]>A[j]){ | ||
leng=max(ar[j], leng); | ||
} | ||
} | ||
ar[i]=leng+1; | ||
|
||
if(max_n<ar[i]){ | ||
max_n=ar[i]; | ||
max_i=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: 증가하는 부분 수열 조건을 잘 찾아주셨네요!!
cin >> A[i]; | ||
} | ||
|
||
cout << checkLongest(N) << "\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: 입출력 메인에서 하는 것도 클린코드 작성에 너무 좋은 것 같습니다ㅎㅎ
up[1]=s[1]; | ||
up[2]=max(up[1]+s[2], s[2]); //당연히 up[1]+up[2]가 더 큼. | ||
up[3]=max(up[1]+s[3], s[2]+s[3]); //1칸+2칸 || 2칸+1칸 | ||
|
||
for(int i=4; i<n+1; i++){ | ||
up[i]=max(up[i-2]+s[i], up[i-3]+s[i-1]+s[i]);//+2칸 || +1칸+1칸 | ||
} | ||
int result=up[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는 점화식을 세우면 반은 끝나는 것 같습니다ㅎㅎ
학번: 2276107
이름: 문재원
#과제
기존제출: 2579, 11053
추가제출 : 20923