Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3c1c19

Browse files
authored
Update 3.cpp
1 parenta64f088 commite3c1c19

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎15/3.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ int main() {
1818
// 이진 탐색 수행을 위해 정렬 수행
1919
sort(arr.begin(), arr.end());
2020

21-
int start =arr[1] - arr[0];//집의 좌표 중에 가장 작은 값
22-
int end = arr[n -1] - arr[0];//집의 좌표 값 중에서 가장 큰 값
21+
int start =1;//가능한 최소 거리 차이(min gap)
22+
int end = arr[n -1] - arr[0];//가능한 최대 거리 차이(max gap)
2323
int result =0;
2424

2525
while (start <= end) {
26-
// mid는 가장 인접한 두 공유기 사이의 거리(Gap)을 의미
26+
// mid는 가장 인접한 두 공유기 사이의 거리(gap)을 의미
2727
int mid = (start + end) /2;
2828
// 첫째 집에는 무조건 공유기를 설치한다고 가정
2929
int value = arr[0];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp