TOJ Open Ural FU Championship 2013 D
D. Dummy Guy
Time limit: 0.5 second
Memory limit: 64 MB
Memory 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 have n bottles 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 error not exceeding 10−6.
Sample
| input | output |
|---|---|
2 |
2 |
Problem Author: folklore
1 #include <map> 2 #include <set> 3 #include <stack> 4 #include <queue> 5 #include <cmath> 6 #include <vector> 7 #include <cstdio> 8 #include <cstring> 9 #include <algorithm> 10 using namespace std; 11 #define maxn 101 12 #define mod 1000000007 13 #define INF 0x7fffffff 14 #define ll long long 15 //#define ll __int64 16 int n, m; 17 int a[maxn]; 18 int main(){ 19 int cas = 1; 20 while (~scanf("%d", &n)){ 21 double a = 180*1.0 / n; 22 if (n == 1){ printf("1\n"); continue; } 23 if (n == 2){ printf("2\n"); continue; } 24 a = a / 180 * 3.1415926; 25 double ans = 1.0 / sin(a); 26 printf("%lf\n", ans+1.0); 27 } 28 return 0; 29 }
浙公网安备 33010602011771号