[nowcoder5667K]Keyboard Free
不妨设$r1\le r2\le r3$,令$f(\alpha)=E(S_{\Delta}ABC)$,其中AB坐标分别为$(r_{1},0)$和$(r_{2}\cos \alpha,r_{2}\sin \alpha)$,C在原点为圆心、$r_{3}$为半径的圆上,那么有答案$ans=\lim_{n\to\infty}\limits\frac{\sum_{i=1}^{n}f(\frac{2\pi i}{n})}{n}$,而由于答案误差可以较大,因此n取1000左右即可
考虑求$f(\alpha)$,可以求出$l=|AB|=\sqrt{(r_{2}\cos\alpha-r_{1})^{2}+(r_{2}\sin \alpha)^{2}}$,作$CH\perp AB$交AB于点H,那么有$f(\alpha)=\frac{l\cdot E(CH)}{2}$
考虑求$E(CH)$,延长AB交最大的圆于点D,作$OE\verb|//|AB$交最大的圆于点E交CH延长线于点H',那么根据这些可以求出$\beta=\angle DOE=\angle ADO=\arcsin \frac{r_{1}r_{2}\sin\alpha}{r_{3}l}$,$h=HH'=r_{3}\sin\beta$,然后对$\gamma=\angle COA-\angle DOA$分类讨论:
1.$\beta\le \gamma< \pi+\beta$,那么$E(CH)=\begin{equation*}\int_{0}^{\pi} h+r_{3}\sin(\gamma-\beta)\ \rm d(\gamma-\beta)\end{equation*}=\pi h+2r_{3}$
2.$\pi+2\beta \le \gamma<2\pi$,那么$E(CH)=\begin{equation*}\int_{\beta}^{\pi-\beta} (r_{3}\sin (\gamma-\beta-\pi)-h)\ \rm d(\gamma-\beta-\pi)\end{equation*}=2r_{3}\cos\beta-(\pi-2\beta)h$
3.$0\le \gamma<\beta$或$\pi+\beta\le \gamma<\pi+2\beta$,那么$E(CH)=2\begin{equation*}\int_{0}^{\beta} (h-r_{3}\sin (\beta-\gamma))\ \rm d(\beta-\gamma)\end{equation*}=2\beta h+2r_{3}(\cos\beta-1)$
综上,$E(CH)=\frac{(\pi h+2r_{3})+(2r_{3}\cos\beta-(\pi-2\beta )h)+(2\beta h+2r_{3}(\cos\beta-1))}{2\pi}=\frac{2\beta h+2r_{3}cos\beta}{\pi}$,代入即可得到$f(\alpha)=\frac{l(\beta h+r_{3}\cos\beta)}{\pi}$
View Code
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define pi acos(-1.0) 4 int t,r1,r2,r3; 5 double sqr(double a){ 6 return a*a; 7 } 8 double f(double a){ 9 double l=sqrt(sqr(r2*cos(a)-r1)+sqr(r2*sin(a))); 10 double h=r1*r2*sin(a)/l; 11 double b=asin(h/r3); 12 return l*(b*h+cos(b)*r3)/pi; 13 } 14 int main(){ 15 scanf("%d",&t); 16 while (t--){ 17 scanf("%d%d%d",&r1,&r2,&r3); 18 if (r1>r2)swap(r1,r2); 19 if (r1>r3)swap(r1,r3); 20 if (r2>r3)swap(r2,r3); 21 double ans=0; 22 for(int i=1;i<=1000;i++)ans+=f(2*i*pi/1000.0)/1000.0; 23 printf("%.1f\n",ans); 24 } 25 }