Skip to content

Commit f7adbfd

Browse files
committed
[level 3] Title: 기지국 설치, Time: 1.39 ms, Memory: 9.61 MB -BaekjoonHub
1 parent 1dbe583 commit f7adbfd

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

프로그래머스/3/12979. 기지국 설치/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### 성능 요약
66

7-
메모리: 9.66 MB, 시간: 2.57 ms
7+
메모리: 9.61 MB, 시간: 1.39 ms
88

99
### 구분
1010

@@ -16,7 +16,7 @@
1616

1717
### 제출 일자
1818

19-
2025년 05월 19일 20:28:40
19+
2025년 05월 19일 20:46:01
2020

2121
### 문제 설명
2222

프로그래머스/3/12979. 기지국 설치/기지국 설치.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ def solution(n:int, stations:list, w:int) -> int:
66
w (int): 전파의 도달거리, 1 <= w <= 10000
77
return (int): 모든 아파트에 전파를 전달하기 위한 최소 기지국 증설값
88
'''
9-
start = 0
9+
idx = 0
1010
cnt = 0
11-
width = 2*w + 1
11+
width = 2*w+1
12+
stations.append(n+w+1)
1213

1314
for i in stations:
14-
diff = i - w - start - 1
15-
cnt += diff//width + bool(diff%width)
16-
start = i + w
17-
diff = n - start
15+
cnt += (i + w - idx - 1)//width
16+
idx = i + w
17+
diff = n - idx
1818

19-
return cnt + diff//width + bool(diff%width)
19+
return cnt

0 commit comments

Comments
 (0)