HOJ 1439 The Circumference of the Circle
2012-11-28 00:06
302 查看
http://acm.hit.edu.cn/hoj/problem/view?id=1439
给出三个点坐标 计算过这三个点的圆的周长
利用a/sinA=2R和S=0.5*bcsinA计算 S可用叉乘算
给出三个点坐标 计算过这三个点的圆的周长
利用a/sinA=2R和S=0.5*bcsinA计算 S可用叉乘算
#include <stdio.h> #include <math.h> const double pi = acos(-1); double find_r(double x1, double y1, double x2, double y2, double x3, double y3); int main() { double r, c; double x1, y1, x2, y2, x3, y3; while (scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3) != EOF) { r = find_r(x1, y1, x2, y2, x3, y3); c =2 * pi * r; printf("%.2lf\n", c); } return 0; } double find_r(double x1,double y1,double x2,double y2,double x3,double y3) { double s,r,a,b,c; s = fabs(0.5 * ((x1-x3) * (y2-y3) - (x2-x3) * (y1-y3))); a = sqrt(pow((x1-x2), 2) + pow((y1-y2), 2)); b = sqrt(pow((x1-x3), 2) + pow((y1-y3), 2)); c = sqrt(pow((x3-x2), 2) + pow((y3-y2), 2)); r = (a*b*c) / (4*s); return r; }
相关文章推荐
- poj 2242 The Circumference of the Circle
- F - The Circumference of the Circle
- HDU 1374 The Circumference of the Circle 计算几何
- hdu 1374 The Circumference of the Circle
- POJ 2242 The Circumference of the Circle 简单数学
- POJ 2242|ZOJ 1090 The Circumference of the Circle
- zoj----1090---The Circumference of the Circle---数学几何
- zoj 1090 The Circumference of the Circle
- zoj1090 The Circumference of the Circle
- poj 1090:The Circumference of the Circle(计算几何,求三角形外心)
- poj 2242 The Circumference of the Circle
- The Circumference of the Circle
- ZOJ1090 The Circumference of the Circle
- 2242 The Circumference of the Circle
- POJ2242_The Circumference of the Circle_海伦公式
- zoj 1090 The Circumference of the Circle(海伦公式+正弦定理)
- 438 - The Circumference of the Circle【几何】
- joj1184 The Circumference of the Circle
- ZOJ-1090-The Circumference of the Circle(计算几何,海伦公式,三角形外接圆半径公式,cout输出小数的一些问题)
- POJ 2242 The Circumference of the Circle