-
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
[동적계획법] 9월 27일 #6
base: main
Are you sure you want to change the base?
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.
P3. 11048 코드리뷰 완료
채원님 안녕하세요!
코드가 정말 깔끔하게 작성되었네요! 🥰
사소한 코멘트로는 vector를 새로 선언하지 않고 원래 vector 값을 갱신하며 구현하는 방법도 있습니다!!
11048은 이대로 머지하셔도 될 것 같아요! 수고 많으셨습니다!
궁금한 것이 있으면 리뷰어를 호출해주세요!!😎😎
ans = max_candy[n][m]; | ||
|
||
return ans; |
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.
바로 max_candy[n][m]을 리턴하셔도 됩니다!
vector<vector<int>> candy(n+1, vector<int>(m+1, 0)); | ||
vector<vector<int>> max_candy(n+1, vector<int>(m+1, 0)); |
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.
더미 인덱스 사용하신 것 너무 좋습니다!! 새로 max_candy vector를 만들어도 되고 candy vector에 직접 더해도 됩니다!!
[추가제출 확인 완료] |
** P3 20923 코드 리뷰 완료** |
//for (int i = 0; i < do_ground.size(); i++) { | ||
// su_card.push_back(do_ground.back()); | ||
// do_ground.pop_back(); | ||
//} | ||
// �̷��� �ۼ��ߴµ� Ʋ�ȴ�. | ||
// while ����� �ٲ��ִ� �¾Ҵµ� ���� ���̰� ���� �ڴ�. |
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.
do_ground.size() 는 계속 1씩 줄어듭니다
i는 반면에 계속 1씩 늘어납니다.
그러면, do_ground.size()와 i가 같아지는 순간이 생기게 되고,
이것은 do_ground에 있는 모든 카드를 pop해주지 않고 for문이 종료가 됩니다!!! 🐧
while (!su_ground.empty()) { | ||
do_card.push_back(su_ground.back()); | ||
su_ground.pop_back(); | ||
} | ||
while (!do_ground.empty()) { | ||
do_card.push_back(do_ground.back()); | ||
do_ground.pop_back(); | ||
} | ||
} | ||
|
||
turn++; | ||
} | ||
|
||
// ��� |
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. 합쳐지는 카드 덱(des)과 합치는 카드 덱(src)만 다를 뿐 수연이와 도도가 종을 친 후에 동일한 일을 하고 있지 않나요?? ❓
그래서, des와 src를 매개변수로 하여 이를 함수화하면 더 좋을 것 같습니다!! 🦒 🐘
내용 & 질문
20055 번은 틀렸지만 어디가 잘못된건지 잘 모르겠습니다. 첨삭을 부탁드려도 될까요?
20923 번에 for문으로 작성하였다가 while문으로 수정하여 맞았던 부분이 있는데(주석에 표시해두었습니다) 이 둘이 어떻게 다른지 잘 모르겠습니다.
<기존 제출>
<추가 제출>