一个大圆的半径,里面有相邻的n个小圆,求这些小圆的半径;
思路:
x=sin(2π/n);
r=x*R/(1+x);
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int>PII; const double eps=1e-5; const double pi=acos(-1.0); //const int mod=1e9+7; const int INF=0x3f3f3f3f; int main() { double r,x,R,n; int T,cas=1; scanf("%d",&T); while(T--) { scanf("%lf%lf",&R,&n); x=sin(pi/n); r=(x*R)/(1.0+x); printf("Case %d: %.10lf ",cas++,r); } return 0; }