@@ -0,0 +1,1507 @@
+import java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0Aimport java.math.BigDecimal;%0Aimport java.math.RoundingMode;%0A%0Apublic class FeedTheCat %7B%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));%0A        String%5B%5D timeInput = reader.readLine().split(%22 %22);%0A        int time = Integer.parseInt(timeInput%5B0%5D) * 60 + Integer.parseInt(timeInput%5B1%5D);%0A%0A        String%5B%5D line = reader.readLine().split(%22 %22);%0A        BigDecimal catHungerLevel = new BigDecimal(line%5B0%5D);%0A        BigDecimal hungerIncreasePerMinute = new BigDecimal(line%5B1%5D);%0A        BigDecimal bunCost = new BigDecimal(line%5B2%5D);%0A        BigDecimal hungerDecreasePerBun = new BigDecimal(line%5B3%5D);%0A%0A        int discountTime = 20 * 60;%0A        BigDecimal hungerLevelWhenDiscountStarts = catHungerLevel.add(hungerIncreasePerMinute%0A                .multiply(BigDecimal.valueOf(Math.max(discountTime - time, 0))));%0A%0A        BigDecimal costToFeedWithDiscount = bunCost%0A                .multiply(BigDecimal.valueOf(0.8))%0A                .multiply(hungerLevelWhenDiscountStarts.divide(hungerDecreasePerBun, RoundingMode.UP))%0A                .setScale(4, RoundingMode.HALF_UP);%0A        BigDecimal costToFeedImmediately = bunCost%0A                .multiply(catHungerLevel.divide(hungerDecreasePerBun, RoundingMode.UP))%0A                .setScale(4, RoundingMode.HALF_UP);%0A%0A        System.out.println(costToFeedImmediately.min(costToFeedWithDiscount));%0A    %7D%0A%7D%0A

Add FeedTheCat