-
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월 20일 #4
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "\uC6B0\uC120\uC21C\uC704-\uD050"
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.
p2
수고하셨습니다! 5문제 다 잘 풀어주셨네요~
자세한 코멘트는 코드에 달아놓았으니 확인해주세요.
3613번은 좀 더 리팩토링할 수 있는 부분이 보이네요!
입력받은 문자열이 cpp인지 java인지 먼저 확인하고 java 또는 cpp로 바꾸는거 어떨까요?
함수가 4개 필요하겠네요!
이대로 머지하셔도 좋긴한데, 더 수정하고 싶으시면 수정 후 리뷰어로 저 호출해주세요!
추석 잘 보내세요 현영님!
struct cmp{ | ||
bool operator()(int &a, int &b){ | ||
if(abs(a) != abs(b)) | ||
return abs(a) > abs(b); | ||
return a > b; | ||
} | ||
}; |
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.
👍
if (s[x]) | ||
cout << '1' << '\n'; | ||
else | ||
cout << '0' << '\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.
이것도 아래 toggle 처럼 한 출로 나타낼 수 있어요!
|
||
vector<bool> s(21, false); |
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.
잘 푸셨습니다! 근데 이 배열조차 사용하지 않고 int 변수 하나로 문제를 풀 수 있는 방법도 있어요!
비트마스킹에 대해 알아보시겠어요? 좀 어려울 수도 있으니 알아만 보셔도 좋아요
for(int j=0; j<people; j++){ | ||
int t; | ||
cin >> t; | ||
} |
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.
이 부분은 중복되니까 밖으로 빼면 어떨까요?
long long a, b; | ||
a = q.top(); | ||
q.pop(); | ||
b = q.top(); | ||
q.pop(); | ||
q.push(a+b); | ||
q.push(a+b); |
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.
여긴 중복이 조금 있으니까 반복문으로 처리해도 좋아요!
} | ||
else{ |
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.
위에 있는 if 문에 걸리면 무조건 리턴하니 이 else는 필요 없어요
|
||
string from_cpp(int i, string answer, string str){ |
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.
카멜 표기법 사용해주세요~
answer += tolower(c); | ||
} | ||
else | ||
answer += c; |
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.
이 부분은 합칠 수 있는 방법이 있어요~
No description provided.