POJ 2242

 1 #include <iostream>
 2 #include <cmath>
 3 #include <iomanip>
 4 using namespace std;
 5 #define PI 3.141592653589793
 6
 7 struct node
 8 {
 9     double x;
10     double y;
11 };
12
13 node p_1;
14 node p_2;
15 node p_3;
16
17 double a;
18 double b;
19 double c;
20 double give_len(node a,node b);
21
22 int main()
23 {
24     //freopen("acm.acm","r",stdin);
25     double cos_c;
26     double sin_c;
27     double s;
28     while(cin>>p_1.x>>p_1.y>>p_2.x>>p_2.y>>p_3.x>>p_3.y)
29     {
30         a = give_len(p_1,p_2);
31         b = give_len(p_1,p_3);
32         c = give_len(p_2,p_3);
33     //    cout<<"--- a"<<a<<endl;
34     //    cout<<b<<endl;
35     //    cout<<c<<endl;
36         cos_c = (a*a + b*b - c*c)/(2.0*a*b);
37         sin_c = sqrt((1 - cos_c*cos_c));
38         s = 0.5 * a*b*sin_c;
39         cout<<setiosflags(ios::fixed)<<setprecision(2)<<a*b*c*PI/(s*2.0)<<endl;
40     }
41 }
42
43 double give_len(node a,node b)
44 {
45     return sqrt( (a.x-b.x)*(a.x-b.x) + (a.y - b.y)*(a.y - b.y) );
46 }
时间: 2024-10-27 05:49:48

POJ 2242的相关文章

poj 2242(已知三点求外接圆周长)

The Circumference of the Circle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8310   Accepted: 4960 Description To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't

poj 2242 The Circumference of the Circle

题目大意:给出三个点的坐标,求三点组成的三角形的外接圆的周长,假设已知三角形边长a,b,c和三角形面积s,则外接圆直径 d = (a*b*c)/(2*s) #include <iostream> #include <cmath> #include <iomanip> using namespace std; const double pi=3.141592653589793; int main() { double x1,y1,x2,y2,x3,y3,a,b,c,st,

图论 500题——主要为hdu/poj/zoj

转自——http://blog.csdn.net/qwe20060514/article/details/8112550 =============================以下是最小生成树+并查集======================================[HDU]1213   How Many Tables   基础并查集★1272   小希的迷宫   基础并查集★1325&&poj1308  Is It A Tree?   基础并查集★1856   More i

ACM训练方案-POJ题目分类

ACM训练方案-POJ题目分类 博客分类: 算法 ACM online Judge 中国: 浙江大学(ZJU):http://acm.zju.edu.cn/ 北京大学(PKU):http://acm.pku.edu.cn/JudgeOnline/ 杭州电子科技大学(HDU):http://acm.hdu.edu.cn/ 中国科技大学(USTC):http://acm.ustc.edu.cn/ 北京航天航空大学(BUAA)http://acm.buaa.edu.cn/oj/index.php 南京

转载:poj题目分类(侵删)

转载:from: POJ:http://blog.csdn.net/qq_28236309/article/details/47818407 按照ac的代码长度分类(主要参考最短代码和自己写的代码) 短代码:0.01K–0.50K:中短代码:0.51K–1.00K:中等代码量:1.01K–2.00K:长代码:2.01K以上. 短:1147.1163.1922.2211.2215.2229.2232.2234.2242.2245.2262.2301.2309.2313.2334.2346.2348

poj题库分类

初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (1)图的深度优先遍历和广度优先遍历.     (2)最短路径算法(dijkstra,bellman-ford,floyd,hea

POJ题目(转)

http://www.cnblogs.com/kuangbin/archive/2011/07/29/2120667.html 初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (

Poj 题目分类

初期:一.基本算法:     (1)枚举. (poj1753,poj2965)     (2)贪心(poj1328,poj2109,poj2586)     (3)递归和分治法.     (4)递推.     (5)构造法.(poj3295)     (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法:     (1)图的深度优先遍历和广度优先遍历.     (2)最短路径算法(dijkstra,bellman-ford,floyd,hea

POJ 2196 Computer(搜索-深度优先搜索)

Computer Problem Description A school bought the first computer some time ago(so this computer's id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Managers of school are