From 79c351244a8b89c76031d14cdff50d9aaeffe20e Mon Sep 17 00:00:00 2001 From: lkhyun <102892446+lkhyun@users.noreply.github.com> Date: Sat, 22 Nov 2025 23:19:07 +0900 Subject: [PATCH] =?UTF-8?q?[20251122]=20PGM=20/=20Lv2=20/=20=EA=B8=B0?= =?UTF-8?q?=EC=A7=80=EA=B5=AD=20=EC=84=A4=EC=B9=98=20/=20=EC=9D=B4?= =?UTF-8?q?=EA=B0=95=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\352\265\255 \354\204\244\354\271\230.md" | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 "lkhyun/202511/22 PGM Lv2 \352\270\260\354\247\200\352\265\255 \354\204\244\354\271\230.md" diff --git "a/lkhyun/202511/22 PGM Lv2 \352\270\260\354\247\200\352\265\255 \354\204\244\354\271\230.md" "b/lkhyun/202511/22 PGM Lv2 \352\270\260\354\247\200\352\265\255 \354\204\244\354\271\230.md" new file mode 100644 index 00000000..bc6c39b0 --- /dev/null +++ "b/lkhyun/202511/22 PGM Lv2 \352\270\260\354\247\200\352\265\255 \354\204\244\354\271\230.md" @@ -0,0 +1,26 @@ +```java +class Solution { + public int solution(int n, int[] stations, int w) { + int answer = 0; + + int idx = 1; + for(int station : stations){ + if(idx < station - w){ + answer += install(idx,station-w-1,w); + } + idx = station+w+1; + if(station+w >= n) break; + } + if(idx <= n){ + answer += install(idx,n,w); + } + + return answer; + } + public int install(int start, int end, int w){ + int range = end - start + 1; + int size = w*2 + 1; + return range%size != 0 ? range/size + 1 : range/size; + } +} +```