Skip to main content
2 of 5
added 209 characters in body
Manuel Allenspach
  • 4.8k
  • 1
  • 21
  • 44

#Hungry, Java

public class Hungry {
    public static void main(String[] args) {
        double[] arguments = new double[4];
        for (int i = 0; i < 4; i++) {
            arguments[i] = Double.parseDouble(args[i]);
        }
        if (arguments[3] == 1) {
            System.out.println(arguments[1]);
        } else {
            int myCake = (int) Math.ceil(arguments[1]/arguments[3]);
            System.out.println(myCake);            
        }
    }
}

Always wants a little bit more than its fair share. If it is the last player, take everything.

Manuel Allenspach
  • 4.8k
  • 1
  • 21
  • 44