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

[동적 계획법] 9월 27일 #9

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

Conversation

songing01
Copy link
Contributor

@songing01 songing01 commented Oct 3, 2022

내용 & 질문

동적계획법 과제 제출합니다!
질문: 11053번이 백준에서 주어진 예제는 답이 다 맞게 나오는데, 최종 결과가 틀리게 나오는데.. 원인을 찾지 못했습니다..

이후에 블로그 글 참고한 코드를 다시 제출을 해서 백준에선 맞게처리는 되었으나, 참고하기 이전 코드가 왜 틀린지 모르겠어서 이전 코드로 제출했습니다..!!

사정 상 제 컴퓨터 사용을 못해서, 깃허브 페이지 자체에서 파일을 올리게 되어 폴더안에 파일을 넣지 못했고, 형식이 좀 다를 수 있을것 같습니다.. 검토 받은뒤에 수정해서 머지하도록 하겠습니당

<기존 제출>

11053번, 20923번

<추가 제출>

20055 11048

@Dong-droid
Copy link

P3. 20923 코드 리뷰 완료
푸시느라 수고하셨습니다~! 🔥 🔥
전체적으로 코드가 깔끔해서 읽기 편했어요! 😸
클린 코드를 위해 몇 가지 제안 드리는 점을 적어봤습니다 :) 참고해주시기 부탁 드립니다 😸

Comment on lines +6 to +10

int n, m;
string final_winner;
deque<int> dodo, suyeon, do_ground, su_ground;

Choose a reason for hiding this comment

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

P3. 클린 코드를 위해 전역 변수 사용을 지양해주시기를 부탁 드립니다! 😸 🐈

if (do_ground.front() == 5) return 'd';
if (su_ground.front() == 5) return 'd';
if (do_ground.size() && su_ground.size() && dodo.front() + suyeon.front() == 5) return 's';
return 0;
Copy link

@Dong-droid Dong-droid Oct 3, 2022

Choose a reason for hiding this comment

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

P3. return 0은 없어도 되겠죠?! 😃

Comment on lines +41 to +65
if (winner == 'd') {
while (!su_ground.empty()) {
//수연이 그라운드 카드가 남을떄까지 뒤에서부터 빼서 뒤로 넣기
dodo.push_back(su_ground.back());
su_ground.pop_back();
}
while (!do_ground.empty()) {
//본인 그라운드 카드 넣기
dodo.push_back(do_ground.back());
do_ground.pop_back();
}

} else if (winner == 's') {
while (!do_ground.empty()) {
suyeon.push_back(do_ground.back());
do_ground.pop_back();
}
while (!do_ground.empty()) {
//본인 그라운드 카드 넣기
suyeon.push_back(su_ground.back());
su_ground.pop_back();
}

}

Choose a reason for hiding this comment

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

P3. 카드를 합치는 부분은 함수화 하는 것을 제안드립니다!!
합쳐지는 source 카드와 destination 카드 덱만 다를 뿐 동일한 일을 하고 있지 않나요?
함수화하면 더 🌷 한 코드가 될 것 같아요!

Copy link

@flowersayo flowersayo left a comment

Choose a reason for hiding this comment

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

안녕하세요 지민님!
참고하기 이전 코드를 올려주셨다고 했는데 수정 이후 코드가 올라온 것 같네요..!
다시 올려주시면 한번 더 피드백 드리겠습니다~!
업데이트하시고 저 리뷰어로 호출 부탁드려요
과제 수고 많으셨습니다🥰

for (int i = 0; i < n; i++){
ans = max(ans, dp[i]); //가장 긴 길이찾기
}

Choose a reason for hiding this comment

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

참고하기 이전 코드를 올려주셨다고 했는데 수정 이후 코드가 올라온 것 같네요..!
다시 올려주시면 한번 더 피드백 드리겠습니다~! 지금 코드는 정말 완벽해요🥰

Copy link
Contributor Author

Choose a reason for hiding this comment

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

안녕하세요! 11053번은 제대로 제출한게 맞고, 20923번이 백준에서 틀리게 나오는건데 착각했네요!!

Copy link

@jk0527 jk0527 left a comment

Choose a reason for hiding this comment

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

11048 추가제출 확인했습니다!

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.

4 participants