• + 0 comments
    public static void bonAppetit(List<Integer> bill, int k, int b) {
        int supposedSum = 0;
        for(int i=0;i<bill.size();i++) {
            if(i!=k) supposedSum += bill.get(i);
        }
        int supposedPaid = supposedSum/2;
        if(supposedPaid == b) System.out.println("Bon Appetit");
        else {
            int toRefund = b-supposedPaid;
            System.out.println(toRefund);
        }
    }