-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path10283 - The Kissing Circles.cpp
58 lines (55 loc) · 1.6 KB
/
10283 - The Kissing Circles.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Rezwan_4029
AUST , CSE-25
*/
#include <bits/stdc++.h>
#define pb push_back
#define INF 1<<29
#define all(x) x.begin(),x.end()
#define ms(a,v) memset(a,v,sizeof a)
#define II ({int a; scanf("%d", &a); a;})
#define LL ({ll a; scanf("%lld", &a); a;})
#define EPS 1e-12
#define pi 3.1415926535897932384626433832795
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi ;
typedef vector<ll>vl;
typedef pair<int,int>pii;
typedef pair<ll,ll>pll;
#define forab(i, a, b) for (__typeof (b) i = (a) ; i <= b ; ++i)
#define rep(i, n) forab (i, 0, (n) - 1)
#define For(i, n) forab (i, 1, n)
#define rofba(i, a, b) for (__typeof (b)i = (b) ; i >= a ; --i)
#define per(i, n) rofba (i, 0, (n) - 1)
#define rof(i, n) rofba (i, 1, n)
#define forstl(i, s) for (__typeof ((s).end ()) i = (s).begin (); i != (s).end (); ++i)
int main()
{
#ifdef LOCAL
freopen ("in.txt", "r", stdin);
#endif
double R , N ;
while( scanf("%lf %lf",&R,&N) != EOF )
{
if( N == 1 )
{
printf("%.10lf %.10lf %.10lf\n",R,0.0,0.0);
continue ;
}
if( N == 2 )
{
printf("%.10lf %.10lf %.10lf\n",R/2.00,0.0,pi*R*R/2.00);
continue ;
}
double angle = pi / N ;
double alpha = sin( angle );
double r = ( R * alpha ) / ( 1.00 + alpha );
double a = 2.00 * r ;
double H = sqrt( (R-r) * (R-r) - r*r ) ;
double I = N * r * ( H - (pi/2 - angle)*r );
double E = pi * R*R - I - ( N * pi * r * r );
printf("%.10lf %.10lf %.10lf\n",r,I,E);
}
}