| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
这题是解三角形这题是解三角形,适合高中生做,大家在高二一定能做出来。
三个公式
海伦公式
三角形正弦定理
三角形面积公式
s= (a*b) sin(C) / 2 ;
s= sqrt( p* (p-a) * (p-b) * (p-c))
a/sin(A)==b/(sin (B))==c / sin(C) == 三角形外接圆直径
# include <stdio.h>
# include <string.h>
# include <math.h>
# define PII 3.141592653589793
double dot[6];
int main(){
while(~scanf("%lf%lf%lf%lf%lf%lf",&dot[0],&dot[1],&dot[2],&dot[3],&dot[4],&dot[5])){
double a=0,b=0,c=0,p=0,d=0,s=0,ans=0;
a=sqrt( (dot[0]-dot[2]) * (dot[0]-dot[2]) + (dot[1]-dot[3])* (dot[1]-dot[3]));
b=sqrt( (dot[0]-dot[4]) * (dot[0]-dot[4]) + (dot[1]-dot[5])* (dot[1]-dot[5]));
c=sqrt( (dot[2]-dot[4]) * (dot[2]-dot[4]) + (dot[5]-dot[3])* (dot[5]-dot[3]));
p=(a+b+c)/2.0;
s=sqrt(p*(p-a)*(p-b)*(p-c));
d=a*b*c/(s*2);
//printf(" zhijing %lf\n",d);
ans=PII*d;
printf("%.2lf\n",ans);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator