Skip to content

[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

Merged
merged 8 commits into from
Sep 22, 2024
Merged

[2주차] 고다혜 #19

merged 8 commits into from
Sep 22, 2024

Conversation

KodaHye
Copy link
Contributor

@KodaHye KodaHye commented Sep 16, 2024

No description provided.

@KodaHye KodaHye changed the title 고다혜: [CT] 예술성_240916 [2주차] 고다혜 Sep 16, 2024
@KodaHye KodaHye self-assigned this Sep 20, 2024
static void mst() {
int cnt = 0;
while(!pq.isEmpty() && cnt < N - 2) {
Edge current = pq.poll();
Copy link
Contributor

Choose a reason for hiding this comment

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

간선 비용이 더 작은 것을 우선순위 큐로 출력하는 것이 최적화된 좋은 방법인거 같아요! 👍

Copy link
Contributor

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]);
Copy link
Contributor

Choose a reason for hiding this comment

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

요거.. 흥미롭네요🫨

Copy link
Contributor Author

@KodaHye KodaHye Sep 21, 2024

Choose a reason for hiding this comment

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

ㅋㅎㅋㅎㅋ... 제가 생각하기에 삼항연산자 쓰면 직관적인거 같기도 하고,,,, 숏코딩하는거 좋아합니다,,,

Comment on lines +33 to +38
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;
Copy link
Contributor

Choose a reason for hiding this comment

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

빠른 입출력! 사용하셨군요👍🏻 확실히 빠릅니다요..
종종 문제에 따라선 입력을 받을 때 요상하게 받아와서 로직은 문제가 없는데 틀렸다고 나올 때가 있습니다
표준 입출력 이라는 문구가 있으면 그냥 BufferedReader 사용하기도 합니다!

Copy link
Contributor Author

@KodaHye KodaHye Sep 21, 2024

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

에러 방지를 위해서 비교하기 전에 문자열의 길이를 체크하는 것 좋은 습관 같습니다!
하지만 문제에서 제한 사항에 아래와 같이 적혀있어서 따로 체크하지는 않아도 될 것 같아요👍🏻

  • 각 단어의 길이는 3 이상 10 이하이며 모든 단어의 길이는 같습니다.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아하!,,, 문제를 잘 읽지 않아서 모든 단어의 길이가 같다는 걸 놓쳤네요!!

감사합니다!

@Jewan1120 Jewan1120 requested a review from baexxbin September 21, 2024 11:44
@KodaHye KodaHye merged commit 612e1f7 into GreatAlgorithm-Study:main Sep 22, 2024
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