import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; /** * Version 6/4/2014 * @author Caleb Bryson && Alex Haag && Lucas Benda */ public class Driver { public static void main(String[] args) throws FileNotFoundException { Scanner in = new Scanner(new File("box.in")); PrintWriter out = new PrintWriter("box.out"); while (in.hasNext()) { Paper box = new Paper(in.nextDouble(), in.nextDouble()); out.println(box); } out.close(); } } class Paper { double w, l, minVol, maxVol; Paper(double in_w, double in_l) { w = in_w; l = in_l; minVol = minVol(w, l); maxVol = maxVol(w, l); } private double minVol(double w, double l) { //double min = ((-(-(4 * w) - 4 * l) + Math.sqrt(Math.pow((-(4 * w) - 4 * l), 2) - 48 * w * l)) / 24); double min; if (w > l) min = l/2; else min = w/2; return min; } private double maxVol(double w, double l) { double max = ((-(-(4 * w) - 4 * l) - Math.sqrt(Math.pow((-(4 * w) - 4 * l), 2) - 48 * w * l)) / 24); return max; } @Override public String toString() { String string = String.format("%.3f %.3f", maxVol, minVol); return string; } }