-
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?
The head ref may contain hidden characters: "06_\uADF8\uB9AC\uB514"
[그리디] 9월 27일 #6
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.
[그리디 알고리즘 구현 코드 리뷰 완료]
18111 (P3)
전체적으로 깔끔하고 좋은 코드로 작성해주셨네요! 코멘트 남긴 부분 확인해주세요! 수고하셨습니다!
|
||
|
||
pair<int, int> plainGround(int n, int m, int b, vector<vector<int>>& ground, int vmin, int vmax){ | ||
int mintime = 256*500*500*2, maxheight = 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.
최댓값을 계산해주신 점 좋습니다! 하지만 더 안전한 방법으로 c++에서 최댓값(INF)을 다루는 여러 가지 방법에 대해 찾아보셔도 좋을 것 같네요!
int mintime = 256*500*500*2, maxheight = 0; | ||
for(int h=vmin; h<=vmax; h++){ //땅의 높이는 vmin~vmax까지 가능 | ||
int add = 0, rm = 0; //더하는 블록의 수, 빼는 블록의 수 | ||
for(int i=0; i<n; 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.
주석 많이 달아 주신 점 좋습니다!
|
||
} | ||
} | ||
pair<int, int> ans = plainGround(n, m, b, ground, vmin, vmax); |
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.
많이 쓰이는 자료형은 typedef를 이용해서 별칭 지정해보시는 건 어떨까요?
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.
[그리디 알고리즘 코드 리뷰 완료]
1213(P3), 17451(P3)
안녕하세요 도현님! 코드 리뷰 완료되었습니다👍
주석화, 함수 분리도 너무 좋았고, 문제도 깔끔하게 너무 잘 풀어주셨어요!
몇 가지 사소한 코멘트 남겼습니다.
궁금하신 점이 있다면 리뷰어를 호출해주세요!
if(odd_info.first>1) { | ||
cout << "I'm Sorry Hansoo"; | ||
return 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.
팰린드롬을 만들 수 없는 조건을 잘 발견해주셨네요!👍
} | ||
} | ||
string reverse_ans = ans; | ||
reverse(reverse_ans.begin(), reverse_ans.end()); |
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.
reverse 함수를 사용해 문자열을 뒤집어주셨네요! 좋아요~
} | ||
|
||
|
||
string palindrome(const vector<int>& alpha, int mid_idex){ |
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.
벡터의 값이 변경되지 않도록 const 붙여주신 점 좋습니다👍
if(speed[i]<speed[i+1]){ | ||
//다음 행성까지의 속도 < 현재속도 * n을 만족하는 최소값 | ||
//시간 초과 문제 발생 -> 반복문으로 계산하지 않는다. | ||
if(speed[i+1]%speed[i]==0){ //배수관계인 경우 | ||
speed[i] = speed[i+1]; | ||
} | ||
else{ //배수관계가 아닌 경우 | ||
speed[i] = speed[i] * (speed[i+1] / speed[i] + 1); | ||
} | ||
|
||
} |
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.
최소 속도를 만드는 조건을 파악해서 문제를 잘 풀어주셨네요!👍
인적사항
학번 : 1876263
이름 : 이도현
과제제출
기존 제출 : 18111, 1213, 17451
추가 제출 :