• URAL 1984. Dummy Guy(数学啊)


    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1984


    1984. Dummy Guy

    Time limit: 0.5 second
    Memory limit: 64 MB
    Problem illustration
    Every year students of our university participate in Regional Contest in Saint Petersburg. Train journeys from Yekaterinburg to Saint Petersburg make students very thirsty, so they usually take a lot of drinks with them. But the director of Institute of Mathematics and Computer Sciences doesn’t like when students carry all these bottles. So the students try to hide their bottles from the director. The Psych Up team invented a special device for that: a dummy guy.
    The very first journey showed that the dummy guy can hardly hide two bottles. So you have decided to make a new dummy guy. You have nbottles that can be considered as cylinders of a unit radius. At first you want to draw a circle and place all your bottles inside it so that each of the bottle bottoms touches the circle. What is the minimum radius of such circle?

    Input

    The only line contains an integer n that is the number of bottles (1 ≤ n ≤ 10).

    Output

    Output the minimum radius of a circle with an absolute or relative error not exceeding 10−6.

    Sample

    input output
    2
    
    2

    题意:

    求一个大圆能包括n个半径为一的小圆的最小半径!

    PS:

    把每一个小圆的圆心连起来就是一个正n多边形,就是求多边形中心到顶点的距离,画一条与小圆相切的切线,构成一个直角三角形,用正弦定理就能够求出来。再加上一个小圆的半径1。就好了,绘图就明确了!

    代码例如以下:

    #include <cstdio>
    #include <cmath>
    #define PI acos(-1.0)
    int main()
    {
        int n;
        while(~scanf("%d",&n))
        {
            if(n == 1)
            {
                printf("1
    ");
                continue;
            }
            double ans = 1.0/(sin(PI*1.0/n));
            ans += 1;
            printf("%.6lf
    ",ans);
        }
        return 0;
    }


  • 相关阅读:
    HDU 3605 Escape
    ZOJ 2587 Unique Attack
    POJ 3686 The Windy's
    POJ 3084 Panic Room
    SGU 206 Roads
    POJ 3189 Steady Cow Assignment
    POJ 2125 Destroying The Graph
    PLS_INTEGER类型与timestamp类型、date、及时间函数
    SDO_Geometry说明
    with与树查询的使用
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/6818721.html
Copyright © 2020-2023  润新知