From 07301c01e0d9645fa5343275a585b8854924f5c0 Mon Sep 17 00:00:00 2001 From: suyeun84 <81475092+suyeun84@users.noreply.github.com> Date: Mon, 6 Oct 2025 22:50:17 +0900 Subject: [PATCH] =?UTF-8?q?[20251006]=20PGM=20/=20Lv2=20/=20=ED=8D=BC?= =?UTF-8?q?=EC=A6=90=20=EA=B2=8C=EC=9E=84=20=EC=B1=8C=EB=A6=B0=EC=A7=80=20?= =?UTF-8?q?/=20=EA=B9=80=EC=88=98=EC=97=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...4 \354\261\214\353\246\260\354\247\200.md" | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 "suyeun84/202510/PGM LV2 \355\215\274\354\246\220 \352\262\214\354\236\204 \354\261\214\353\246\260\354\247\200.md" diff --git "a/suyeun84/202510/PGM LV2 \355\215\274\354\246\220 \352\262\214\354\236\204 \354\261\214\353\246\260\354\247\200.md" "b/suyeun84/202510/PGM LV2 \355\215\274\354\246\220 \352\262\214\354\236\204 \354\261\214\353\246\260\354\247\200.md" new file mode 100644 index 00000000..b2f6ce59 --- /dev/null +++ "b/suyeun84/202510/PGM LV2 \355\215\274\354\246\220 \352\262\214\354\236\204 \354\261\214\353\246\260\354\247\200.md" @@ -0,0 +1,24 @@ +```java +class Solution { + public int solution(int[] diffs, int[] times, long limit) { + int answer = 0; + int start = 1; + int end = 300000; + while (start < end) { + int mid = (start + end) / 2; + long time = 0; + for (int i = 0; i < diffs.length; i++) { + if (diffs[i] <= mid) time += times[i]; + else { + int wrong = diffs[i] - mid; + if (i == 0) time += (times[0] * wrong + times[i]); + else time += ((times[i]+times[i-1]) * wrong + times[i]); + } + } + if (time <= limit) end = mid; + else start = mid + 1; + } + return start; + } +} +```