Programmers / 3단계 / 기지국 설치 / python
·
Coding Test/Programmers
https://school.programmers.co.kr/learn/courses/30/lessons/12979 코드 def solution(n, stations, w): answer = 0 std = w * 2 + 1 start = 1 for s in stations: if s - w - start > 0: answer += (s - w - start)//std if (s - w - start) % std: answer += 1 start = s + w + 1 if n - start + 1 > 0: answer += (n - start + 1) // std if (n - start + 1) % std: answer += 1 return answer 전파의 도달거리 w의 의미는 w*2+1 크기 만큼의 ..