~cpp
#include <iostream>
#include <cmath>
using namespace std;

void process(double l, double w)
{
	double max_v = (2*(w+l) - sqrt(pow(2*(w+l), 2) - (12*w*l)))/12;
	double min_v = l < w ? l : w;
	cout << max_v << " " << 0.0 << " " << min_v/2 <<endl; 
}

int main()
{
	cout.setf(ios::fixed, ios::floatfield);     
    cout.setf(ios::showpoint);     
    cout.precision(3);   

	double l, w;
	while(cin >> l >> w)
	{
		process(l, w);
	}

	return 0;
}

TheLargestSmallestBox
Retrieved from http://wiki.zeropage.org/wiki.php/TheLargestSmallestBox/허준수
last modified 2021-02-07 05:28:12