URAL 1984. Dummy Guy(数学啊)

题目链接:?space=1&num=1984

1984. Dummy Guy

Time limit: 0.5 secondMemory limit: 64 MB

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 havenbottles 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 integernthat is the number of bottles (1 ≤n≤ 10).

Output

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

Sample

inputoutput

22

题意:

求一个大圆能包含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\n");continue;}double ans = 1.0/(sin(PI*1.0/n));ans += 1;printf("%.6lf\n",ans);}return 0;}

,我知道按攻略去旅行的人往往玩得过于按步就班,

URAL 1984. Dummy Guy(数学啊)

相关文章:

你感兴趣的文章:

标签云: