In order to become a magical girl, Thinking-Bear are learning magic circle.
He first drew a regular polygon of N sides, and the length of each side is a.
He want to get a regular polygon of N sides, and the polygon area is no more than L.
He doesn't want to draw a new regular polygon as it takes too much effort.
So he think a good idea, connect the midpoint of each edge and get a new regular polygon of N sides.
How many operations does it need to get the polygon he want?
输入描述:
The first line of the input is T(1≤ T ≤ 100), which stands for the number of test cases you need to solve. The first line of each case contains three space-separated integers N, a and L (3 ≤ N ≤ 10, 1 ≤ a ≤ 100, 1 ≤ L ≤ 1000).
输出描述:
For each test case, output a single integer.
输入
1 4 2 3
输出
1
S = sin(2 * pi / n) * n * R * R( R: 外接圆半径);
R = a / ( sin(pi / n) * 2 );
多边形内角和:(n - 2)* 180;
相邻中点连线构成的多边形面积比:(R1 * R1) / (R2 * R2);
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi = acos(-1.0);
const double eps = 1e-5;
int main()
{
int T;
scanf("%d", &T);
for(int Case = 1; Case <= T; Case++){
double l, a;
int n;
scanf("%d%lf%lf", &n, &a, &l);
double t = sin((n - 2) * pi / n / 2.0);
t *= t;
double r = a / sin(pi / n) / 2.0;
double s = 0.5 * sin(2.0 * pi / n) * n * r * r;
int i = 0;
while(1){
if(s <= l){
printf("%d\n", i);
break;
}
else{
s *= t;
}
i++;
}
}
return 0;
}