-
Notifications
You must be signed in to change notification settings - Fork 4
[2주차] 고다혜 #19
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
[2주차] 고다혜 #19
Conversation
static void mst() { | ||
int cnt = 0; | ||
while(!pq.isEmpty() && cnt < N - 2) { | ||
Edge current = pq.poll(); |
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.
간선 비용이 더 작은 것을 우선순위 큐로 출력하는 것이 최적화된 좋은 방법인거 같아요! 👍
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.
동감합니다!! cnt < N-2조건으로 최대비용 간선 처리를 쉽게 한것도 멋있어요!
} | ||
|
||
static int find(int a) { | ||
return p[a] = a == p[a] ? a : find(p[a]); |
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.
요거.. 흥미롭네요🫨
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.
ㅋㅎㅋㅎㅋ... 제가 생각하기에 삼항연산자 쓰면 직관적인거 같기도 하고,,,, 숏코딩하는거 좋아합니다,,,
static int read() throws Exception { | ||
int c, n = System.in.read() & 15; | ||
while((c = System.in.read()) >= 48) | ||
n = (n << 3) + (n << 1) + (c & 15); | ||
if(c == 13) System.in.read(); | ||
return 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.
빠른 입출력! 사용하셨군요👍🏻 확실히 빠릅니다요..
종종 문제에 따라선 입력을 받을 때 요상하게 받아와서 로직은 문제가 없는데 틀렸다고 나올 때가 있습니다
표준 입출력
이라는 문구가 있으면 그냥 BufferedReader
사용하기도 합니다!
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.
넵 따라해봤습니다!!! 진짜 확실히 빠르더라구요,,,,
마자요,,예술성 문제 풀 때, 입력이 이상하게 돼서,, 그냥 BufferedReader
로 썼습니다,,,
} | ||
|
||
static int getDiffCnt(String s1, String s2) { | ||
if(s1.length() != s2.length()) 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.
에러 방지를 위해서 비교하기 전에 문자열의 길이를 체크하는 것 좋은 습관 같습니다!
하지만 문제에서 제한 사항에 아래와 같이 적혀있어서 따로 체크하지는 않아도 될 것 같아요👍🏻
- 각 단어의 길이는 3 이상 10 이하이며 모든 단어의 길이는 같습니다.
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.