# I - The Queen’s Super-circular Patio

https://www.cnblogs.com/starve/p/11164586.html

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

#define lowbit(x) x & (-x)
#define lson left,mid,root << 1
#define rson mid+1,right,root << 1 | 1

using namespace std;

typedef pair<int, int> PII;
typedef long long ll;
typedef unsigned long long ull;
const ll mod=1e9+7;
const ll inf=0x3f3f3f3f;
const double pi=acos(-1.0);
const double eps=1e-8;
const int maxn=1e5+100;

int main()
{
int t;
int p, n, k;
scanf("%d",&t);
while(t --)
{
scanf("%d %d %d",&p, &n, &k);
double r0 = 1.0 * pi / n;
double r1 = 1;
double r2 = sin(r0) / (1 - sin(r0));
double a = 1 / (tan(r0) * tan(r0));
double b = -2 * ((r1 + r2) / tan(r0) + r2);
double c = r1 * r1 + 2 * r1 * r2;
double r3 = (-b + sqrt(b * b - 4 * a * c)) / (2 * a);
double r;
for(int i = 3; i <= k; i ++)
{
r = r3 * r3 /r2;
r2 = r3;
r3 = r;
}
if(k == 1)
r = r2;
if(k == 2)
r = r3;
printf("%d %.3lf %.3lf\n",p, r, 2 * pi * r + n * 2 * r);
}

return 0;
}