题目链接

题目大意:

给定三个点,即一个任意三角形,求外接圆的周长。

分析:

外接圆的半径可以通过公式求得(2*r = a/sinA = b/sinB = c/sinC),然后直接求周长。

注意:

C++AC,G++WA。

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath> using namespace std; const double PI = 3.141592653589793; typedef struct Point {
double x, y;
Point (double x=, double y=):x(x),y(y) {};
}Vector; double Dot(Vector A, Vector B) { return A.x*B.x + A.y*B.y; }
double Length(Vector A) { return sqrt(Dot(A, A)); }
double Cross(Vector A, Vector B) { return A.x*B.y - A.y*B.x; } int main(){
double x1, y1, x2, y2, x3, y3, d; while(cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
Vector A(x2-x1, y2-y1), B(x3-x1, y3-y1), C(x3-x2, y3-y2); d = Length(C) / (fabs(Cross(A, B)) / Length(A) / Length(B)); printf("%.2lf\n", d*PI);
} return ;
}

POJ2242 The Circumference of the Circle(几何)的更多相关文章

  1. F - The Circumference of the Circle

    Description To calculate the circumference of a circle seems to be an easy task - provided you know ...

  2. poj 1090:The Circumference of the Circle(计算几何,求三角形外心)

    The Circumference of the Circle Time Limit: 2 Seconds      Memory Limit: 65536 KB To calculate the c ...

  3. ZOJ Problem Set - 1090——The Circumference of the Circle

      ZOJ Problem Set - 1090 The Circumference of the Circle Time Limit: 2 Seconds      Memory Limit: 65 ...

  4. 【POJ2242】The Circumference of the Circle(初等几何)

    已知三点坐标,算圆面积. 使用初等几何知识,根据海伦公式s = sqrt(p(p - a)(p - b)(p - c)) 和 外接圆直径 d = a * b * c / (2s) 来直接计算. #in ...

  5. ZOJ 1090 The Circumference of the Circle

    原题链接 题目大意:已知三角形的三个顶点坐标,求其外接圆的周长. 解法:刚看到这道题时,马上拿出草稿纸画图,想推导出重心坐标,然后求出半径,再求周长.可是这个过程太复杂了,写到一半就没有兴致了,还是求 ...

  6. POJ 2242 The Circumference of the Circle

    做题回顾:用到海伦公式,还有注意数据类型,最好统一 p=(a+b+c)/2; s=sqrt(p*(p-a)*(p-b)*(p-c));//三角形面积,海伦公式 r=a*b*c/(4*s);//这是外接 ...

  7. UVA 11355 Cool Points(几何)

    Cool Points We have a circle of radius R and several line segments situated within the circumference ...

  8. poj2242

                                                        The Circumference of the Circle Time Limit: 1000 ...

  9. [Swift]LeetCode478. 在圆内随机生成点 | Generate Random Point in a Circle

    Given the radius and x-y positions of the center of a circle, write a function randPoint which gener ...

随机推荐

  1. SPOJ 345 - Mixtures 区间动态规划

    有n个混合物排成一排,每个混合物有一个颜色值0<=color<=99, 规定合并只能合并相邻两个, 将颜色a的混合物与颜色b的混合物合并后,颜色为( a+b ) % 100,并产生a*b的 ...

  2. BeanFactory学习

    关于BeanFactory,一个相对易懂的博客,关于深入的理解,后续继续学习 http://www.cnblogs.com/liuling/archive/2013/04/14/BeanFactory ...

  3. Python之路,Day14 - It's time for Django

    Python之路,Day14 - It's time for Django   本节内容 Django流程介绍 Django url Django view Django models Django ...

  4. Day10 - Python协程、异步IO、redis缓存、rabbitMQ队列

    Python之路,Day9 - 异步IO\数据库\队列\缓存   本节内容 Gevent协程 Select\Poll\Epoll异步IO与事件驱动 Python连接Mysql数据库操作 RabbitM ...

  5. 高健壮性css---Float详细

    (一)关于float 首先我们了解到,CSS网页布局的原理,就是按照HTML代码中对象声明的顺序,以流布局的方式来显示它,而流布局就不得不说到float浮动技术..在HTML中的所有对象,默认分为两种 ...

  6. android对象序列化Parcelable浅析

    一.android序列化简介 我们已经知道在Android使用Intent/Bindler进行IPC传输数据时,需要将对象进行序列化. JAVA原本已经提供了Serializable接口来实现序列化, ...

  7. 从cellForRowAtIndexPath 看cell的重用机制

    今天突然发现一个问题,由于对UITableViewCell 的重用机制不是很了解,让我纠结很久: 用过reloadData时候,会调用cellForRowAtIndexPath方法,但是请看以下2种c ...

  8. Asp.Net 母版页

    背景:回顾下以前用到过的asp.net控件 介绍: 使用 ASP.NET 母版页可以为应用程序中的页创建一致的布局.单个母版页可以为应用程序中的所有页(或一组页)定义所需的外观和标准行为.然后可以创建 ...

  9. XMLHelper 类

     这个XMLHelper类中包括了XML文档的创建,文档节点和属性的读取,添加,修改,删除的方法功能的实现,有兴趣的朋友,可以进来看看,所有代码都在WebForm和WinForm中调试通过. 这是下面 ...

  10. DropDownList 控件

    今天打算学习下dropdownlist控件的取值,当你通过数据库控件或dataset绑定值后,但又希望显示指定的值,这可不是简单的值绑定就OK,上网搜了一些资料,想彻底了解哈,后面发现其中有这么大的奥 ...