Skip to content

[4주차] 박지환 JUN13164, JUN9663#7

Open
mycook3 wants to merge 6 commits intomainfrom
jihwan
Open

[4주차] 박지환 JUN13164, JUN9663#7
mycook3 wants to merge 6 commits intomainfrom
jihwan

Conversation

@mycook3
Copy link
Collaborator

@mycook3 mycook3 commented Feb 14, 2023

JUN13164 행복 유치원
아이들이 행복한게 아닌 어른들이 행복한 유치원인 것 같지만, 아무튼
보니까 조를 이루지 않은 아이는 비용이 0으로 측정되는 것으로 보임.
ex) {1, 2}. {3, 4}, 5 일 경우 비용은 1 + 1 + 0 = 2

그러니까 키 순으로 정렬을 하고
작은 아이들끼리 2명씩 묶을 수 있을 만큼 묶고 큰 애들은 최대한 한 명씩 둬서 비용을 줄이는 방식을 사용함.

@mycook3
Copy link
Collaborator Author

mycook3 commented Feb 14, 2023

JUN9663 N_QUEEN

보드가 N X N 의 크기 일 때 퀸의 이동 방식에 따라 한 줄에 한 개의 퀸만 올 수 있다.
결국 N개의 퀸이 있으려면 한 줄에(가로 세로 포함) 한 개씩 N 개 있다는 거니까.
N개의 크기의 배열을 하나 만들어서 퀸의 위치를 파악하면서 조건에 맞고 그 줄에 겹치는 퀸이 없으면 놓아주고, 아니면 다음으로 넘어가면서 검색하는 방식을 사용했다.

Copy link
Collaborator

@eastsage eastsage left a comment

Choose a reason for hiding this comment

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

최고

s_sub[i] = stature[i+1] - stature[i]; // 학생들 키의 차이를 저장
}

Arrays.sort(s_sub); // 차이가 적은 순으로 정력
Copy link
Collaborator

Choose a reason for hiding this comment

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

역시... 필력이 농후하시네요... 정력이라니...

Copy link
Collaborator

Choose a reason for hiding this comment

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

와우..

Copy link
Collaborator

Choose a reason for hiding this comment

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

미취겠네

System.out.println(ans);
br.close();
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

풀이가 같아서 넘어가겠습니다.

}
return true;
}
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

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

풀이가 같아서 넘어가겠습니다.

Copy link
Collaborator Author

@mycook3 mycook3 left a comment

Choose a reason for hiding this comment

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

1753 최단 경로
음 원래는 LIST<int[]> 이런 식으로 하는 걸 생각했는데
다른 사람들이 class 만들어서 사용하는 것을 본 적이 있어서 그렇게 해봐야겠다 생각해서 이번에 해봤슴돠.

정점 u 에서 v로 가는 걸 저장하고 그 길에 해당하는 가중치(w)를 저장합니다.
그 뒤에 이 문제는 K부터 찾아 가니까.
K 에 저장된 길을 하나씩 찾아 가면서 가중치를 비교해보고 더 낮은 걸 저장했슴돠.....

10159 저울
이 문제는 나는 그냥 최단 경로랑 똑같다고 생각이 드는데,
이게 이기냐 지냐의 경우가 있으니까 이기면 1, 지면 0 값을 저장해줍니다.
그러면 이긴 경우를 찾으면 이긴 경우로 쭉 올라가고, 진 경우에도 쭉 따라가서
내가 알 수 있는 값을 count 해주고
총 정점의 개수 - 1 (자시) 한 거에 count 한 값을 빼주면 내가 모르는 애의 수가 나옵니다.
문제 풀고 찾아보니까 이게 원래 다른 알고리즘이 있는 것 같은데 저는 이렇게 해봤슴돠
앞에 두 개랑 너무 똑같아서 뭐라고 해야 할지 모르겠어!
그냥 경로랑 버스비 저장하고 저장된 경로에서 갈 수 있는 데로 다 가는데
버스비를 더해주면서 진행했고,
그러면서 버스비가 비싸지면 더 진행 안하는 식으로 했습니다

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