Skip to main content
Commonmark migration
Source Link

#Hungry, Java

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]);
        }
        int myCake = (int) Math.ceil(arguments[1]/arguments[3]);
        System.out.println(myCake);
    }
}

Always wants its fair share of the remaining cake.

#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]);
        }
        int myCake = (int) Math.ceil(arguments[1]/arguments[3]);
        System.out.println(myCake);
    }
}

Always wants its fair share of the remaining cake.

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]);
        }
        int myCake = (int) Math.ceil(arguments[1]/arguments[3]);
        System.out.println(myCake);
    }
}

Always wants its fair share of the remaining cake.

deleted 44 characters in body
Source Link
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]);
        }
        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 of the last player, take everythingremaining cake.

#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]);
        }
        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.

#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]);
        }
        int myCake = (int) Math.ceil(arguments[1]/arguments[3]);
        System.out.println(myCake);
    }
}

Always wants its fair share of the remaining cake.

Oooops, thanks muddyfish
Source Link
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.

#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.

#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]);
        }
        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.

added 209 characters in body
Source Link
Manuel Allenspach
  • 4.8k
  • 1
  • 21
  • 44
Loading
Source Link
Manuel Allenspach
  • 4.8k
  • 1
  • 21
  • 44
Loading