# 3 条题解

• @ 2019-01-31 22:27:59

#include <stdio.h>
#include <math.h>

int main ()
{
double a,r,theta,ans;
scanf("%lf %lf",&a,&r);
theta=acos((2*r*r-a*a)/(2*r*r));//printf("costheta=%lf and theta=%lf\n",(2*r*r-a*a)/(2*r*r),theta);
ans=r*r*0.5*theta-0.5*sin(theta)*r*r;//printf("gongxing=%lf and triangle=%lf\n",r*r*0.5*theta,0.5*sin(theta)*r*r);
printf("%lf",ans);
}

• @ 2015-07-20 16:30:20

#include <iostream>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
double a,r;
cin >> a >> r;
double p;
p = ((2 * r) + a)/2;
double s;
s=sqrt((p-r)*(p-r)*(p-a)*p);
s=r*r*asin((a/2)/r)-s;
printf("%.6f\n",s);
// system("pause");
return 0;
}

• @ 2015-02-16 13:24:38

【分析】圆形连接弓的两点，就是求S扇形-S三角形
S扇形：过圆形作弓的中垂线，用反三角函数asin(a/2/r)求出alpha=垂线与半径的夹角大小，然后用alpha*r*r求出面积
S三角形：先用勾股定理求出垂线的长度，然后底*高/2求面积
【代码】
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>

using namespace std;

const double Pi=3.14159265358979;

double a,r;

int main(void)
{
freopen("test.in","r",stdin);
scanf("%lf%lf",&a,&r);
printf("%0.6lf\n",asin(a/2/r)*r*r-sqrt(r*r-a/2*a/2)*a/2);
return 0;
}

• 1

ID
1924

3

(无)

230

111

48%