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

[Week11] 크루스칼, 프림 - 하은 #90

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

[Week11] 크루스칼, 프림 - 하은 #90

wants to merge 1 commit into from

Conversation

leeeha
Copy link
Member

@leeeha leeeha commented Jun 22, 2023

풀이는 주석 참고해주세요!

@leeeha leeeha added the c++ solve with c++ label Jun 22, 2023
@leeeha leeeha self-assigned this Jun 22, 2023
Copy link
Contributor

@ljh0608 ljh0608 left a comment

Choose a reason for hiding this comment

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

마지막까지 고생하셨습니다 bb

Comment on lines +49 to +51
int cost = edges[i].first;
int u = edges[i].second.first;
int v = edges[i].second.second;
Copy link
Contributor

Choose a reason for hiding this comment

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

u v 변수네이밍을 사용해서 조금 더 직관적이고 깔끔하네요 배워갑니다!

Comment on lines +26 to +32
if(elec[a] && elec[b])
return;
// 둘 중에 하나만 발전소와 연결된 경우
else if(elec[a] && !elec[b]){
// 발전소가 있는 지점에 연결
parent[b] = a;
result += cost;
Copy link
Contributor

Choose a reason for hiding this comment

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

elec배열을 초기화해주는 로직이 없는데 괜찮을까요? 선언하면서 동시에 0으로 초기화해둬도 좋을 것 같아요!

Comment on lines +49 to +54
float x1 = coord[i].first;
float y1 = coord[i].second;

for(int j = i + 1; j < n; j++){
float x2 = coord[j].first;
float y2 = coord[j].second;
Copy link
Contributor

Choose a reason for hiding this comment

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

저는 float 자료형을 거의 안썼던 것 같은데 (제 기억에는 소수점이 부정확,,, 했던 것 같기도 ,,?) 혹시 사용하신 이유 여쭤봐도 괜찮을까요? 배우려구요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ solve with c++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants