Ellipse

Description

There is an beautiful ellipse whose curve equation is:

\frac {x^2}{a^2} + \frac {y^2}{b^2} = 1 (a > b > 0)
.

There is a parallelogram named P inscribed in this ellipse. At the same time, the parallelogram P is externally tangent to some circle center at the origin (0,0).

Now your task is to output the maximum and minimum area of P among all possible conditions.

Input

The input consists of multiple test cases.

For each test case, there is exactly one line consists of two integers a and b. 0 < b <= a <= 109

Output

For each test case, output one line of two one-space splited numbers: the maximum area and the minimum area. The absolute or relative error of the coordinates should be no more than 10-6.

Sample Input

1 1

Sample Output

2 2
题意:一个椭圆内切一个平行四边形,平行四边形里内切一个以原点为圆心的圆
解题思路:(这撒比的题意,和刘哲贤学姐愣是猜了两个多小时)最后能出的题都出了,他俩在搞下雨的那个数学题,我在看题,画来画去最后还是觉得里面内切一个圆才合适,好好高中几何学的够硬,比划着找出来两个临界状态,但是最后一句话,说了保留精度,但是案例没有输出小数点,唉~弄得最后这个题没出,还是比完赛才试着改了改提交了。
感悟:灵光一闪太**的重要了;
代码:
#include
#include
using namespace std;
int main()
{
    double a,b;
    while(scanf("%lf%lf",&a,&b)!=EOF)
        printf("%f %f\n",2*a*b,(4*a*a*b*b)/(a*a+b*b));
    return 0;
}
posted @ 2016-05-01 21:28  勿忘初心0924  阅读(217)  评论(0编辑  收藏  举报