U E D R , A S I H C RSS

The Largest Smallest Box/허준수

~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;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:12
Processing time 0.0081 sec