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월 20일 #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[우선순위 큐] 9월 20일 #4

wants to merge 1 commit into from

Conversation

aqswa
Copy link
Collaborator

@aqswa aqswa commented Sep 19, 2021

No description provided.

Copy link
Member

@HyunJiLim0406 HyunJiLim0406 left a 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개 필요하겠네요!

이대로 머지하셔도 좋긴한데, 더 수정하고 싶으시면 수정 후 리뷰어로 저 호출해주세요!
추석 잘 보내세요 현영님!

Comment on lines +6 to +12
struct cmp{
bool operator()(int &a, int &b){
if(abs(a) != abs(b))
return abs(a) > abs(b);
return a > b;
}
};
Copy link
Member

Choose a reason for hiding this comment

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

👍

Comment on lines +40 to +43
if (s[x])
cout << '1' << '\n';
else
cout << '0' << '\n';
Copy link
Member

Choose a reason for hiding this comment

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

이것도 아래 toggle 처럼 한 출로 나타낼 수 있어요!

Comment on lines +11 to +12

vector<bool> s(21, false);
Copy link
Member

Choose a reason for hiding this comment

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

잘 푸셨습니다! 근데 이 배열조차 사용하지 않고 int 변수 하나로 문제를 풀 수 있는 방법도 있어요!
비트마스킹에 대해 알아보시겠어요? 좀 어려울 수도 있으니 알아만 보셔도 좋아요

Comment on lines +20 to +23
for(int j=0; j<people; j++){
int t;
cin >> t;
}
Copy link
Member

Choose a reason for hiding this comment

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

이 부분은 중복되니까 밖으로 빼면 어떨까요?

Comment on lines +19 to +25
long long a, b;
a = q.top();
q.pop();
b = q.top();
q.pop();
q.push(a+b);
q.push(a+b);
Copy link
Member

Choose a reason for hiding this comment

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

여긴 중복이 조금 있으니까 반복문으로 처리해도 좋아요!

Comment on lines +55 to +56
}
else{
Copy link
Member

Choose a reason for hiding this comment

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

위에 있는 if 문에 걸리면 무조건 리턴하니 이 else는 필요 없어요

Comment on lines +5 to +6

string from_cpp(int i, string answer, string str){
Copy link
Member

Choose a reason for hiding this comment

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

카멜 표기법 사용해주세요~

Comment on lines +38 to +41
answer += tolower(c);
}
else
answer += c;
Copy link
Member

Choose a reason for hiding this comment

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

이 부분은 합칠 수 있는 방법이 있어요~

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.

2 participants