zoukankan      html  css  js  c++  java
  • 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
    ",2*a*b,(4*a*a*b*b)/(a*a+b*b));
    
        return 0;
    
    }
    
  • 相关阅读:
    原生态 php连接mysql
    sql查询慢 查找
    死锁查询和处理
    linq详细案例
    linq深入
    DataTable 与XML 交互
    DataTable运用
    通过反射修改已有数组的大小
    通过反射取得并修改数组信息
    通过反射机制直接操作属性
  • 原文地址:https://www.cnblogs.com/wuwangchuxin0924/p/5781556.html
Copyright © 2011-2022 走看看