ural 1984. Dummy Guy 【几何】

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

Problem Author: folklore




/*
    题意:给你n个半径为1的圆瓶,这些圆瓶只能紧靠在一个圆内部的边界上(即内切),
          求该圆最小的半径
    类型:几何
    分析:画图可以知道,当所有圆瓶相切并且满足题意的紧靠在一个圆内部的边界上(即内切)时,
          圆的半径可以最小,这时可以求出相应的圆心角a=360度/n,b=a/2即为图中三角形的角度,
          再用sin求出L加上圆瓶半径即为答案
*/

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<iostream>
using namespace std;
#define int_inf ((1<<31)-1)
#define ll_inf ((1ll<<63)-1)
int main()
{
    double n;
    while(scanf("%lf",&n)!=EOF){
        if(n==1){
            printf("1\n");
            continue;
        }
        double nn=(3.1415926)/n;
        printf("%f\n",1/sin(nn)+1);
    }
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值