U E D R , A S I H C RSS

The Lagest Smallest Box/하기웅

이야기

수학문제라 문제만 풀고나니 코딩은 금방 됐다~~

대부분 똑같은 방식으로 풀었으리라 예상하고 설명 안함^^

소스

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

double length, width;

void findMinMax()
{
	if(length<width)
		cout << (length+width - sqrt(length*length - length*width + width*width))/6.0 << " 0.000 " << length/2.0 << endl;
	else
		cout << (length+width - sqrt(length*length - length*width + width*width))/6.0 << " 0.000 " << width/2.0 << endl;
}

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

	while(cin>>length>>width)
		findMinMax();

	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:12
Processing time 0.0089 sec