diff --git "a/lkhyun/202510/05 PGM Lv2 \355\203\235\353\260\260 \353\260\260\353\213\254\352\263\274 \354\210\230\352\261\260\355\225\230\352\270\260.md" "b/lkhyun/202510/05 PGM Lv2 \355\203\235\353\260\260 \353\260\260\353\213\254\352\263\274 \354\210\230\352\261\260\355\225\230\352\270\260.md" new file mode 100644 index 00000000..9b245f02 --- /dev/null +++ "b/lkhyun/202510/05 PGM Lv2 \355\203\235\353\260\260 \353\260\260\353\213\254\352\263\274 \354\210\230\352\261\260\355\225\230\352\270\260.md" @@ -0,0 +1,25 @@ +```java + +class Solution { + public long solution(int cap, int n, int[] deliveries, int[] pickups) { + long answer = 0; + + int deliveryLoad = 0; + int pickupLoad = 0; + + for (int i = n - 1; i >= 0; i--) { + deliveryLoad += deliveries[i]; + pickupLoad += pickups[i]; + + while (deliveryLoad > 0 || pickupLoad > 0) { + deliveryLoad -= cap; + pickupLoad -= cap; + + answer += (i + 1) * 2; + } + } + + return answer; + } +} +```