Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

[동적계획법]4월 2일 #16

wants to merge 2 commits into from

Conversation

lumiere-on
Copy link
Collaborator

@lumiere-on lumiere-on commented Apr 1, 2024

학번: 2276107
이름: 문재원

#과제
기존제출: 2579, 11053
추가제출 : 20923

@lumiere-on lumiere-on linked an issue Apr 1, 2024 that may be closed by this pull request
Copy link

@chaeri93 chaeri93 left a comment

Choose a reason for hiding this comment

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

[동적계획법 구현 코드리뷰 완료]
20923(P3)
재원님 안녕하세요! 추가제출 확인 완료되었습니다👍 수고하셨습니다!

Copy link

@aeyongdodam aeyongdodam left a 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){

Choose a reason for hiding this comment

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

P3: 함수 분리, 명확한 함수 네이밍 너무 좋습니다!!

Comment on lines +15 to +29
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;
}
}

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";

Choose a reason for hiding this comment

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

P3: 입출력 메인에서 하는 것도 클린코드 작성에 너무 좋은 것 같습니다ㅎㅎ

Comment on lines +12 to +19
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];

Choose a reason for hiding this comment

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

P3: 계단오르기 점화식 조건을 잘 찾아주셨네요!! dp는 점화식을 세우면 반은 끝나는 것 같습니다ㅎㅎ

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.

07_동적계획법
3 participants