ZOJ Problem Set - 1090——The Circumference of the Circle
|
ZOJ Problem Set - 1090
The Circumference of the Circle
Time Limit: 2 Seconds Memory Limit: 65536 KB To calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don't? You are given the cartesian coordinates of three non-collinear points in the plane. Input SpecificationThe input file will contain one or more test cases. Each test case consists Output SpecificationFor each test case, print one line containing one real number telling Sample Input0.0 -0.5 0.5 0.0 0.0 0.5 Sample Output3.14 Source: University of Ulm Local Contest 1996 |
#include<bits/stdc++.h>
#define pi 3.141592653589793 using namespace std; double len(double a,double b,double c,double d)
{
return sqrt((a-b)*(a-b)+(c-d)*(c-d));
} int main()
{
double x1,x2,x3,y1,y2,y3;
while(cin>>x1>>y1>>x2>>y2>>x3>>y3)
{
//求内接三角形的每一个边
double a=len(x1,x2,y1,y2),b=len(x1,x3,y1,y3),c=len(x2,x3,y2,y3);
//求2R=a/sinA 因为不知道sinA 所以先求cosA 那么就是cosA = b^2-c^2/2bc 然后1-cosA的平方=sinA的平方
double cosa=(b*b+c*c-a*a)/(*b*c);
double sina=sqrt(-cosa*cosa);
double d=a/sina;
printf("%.2f\n",pi*d);
}
return ;
}
ZOJ Problem Set - 1090——The Circumference of the Circle的更多相关文章
- poj 1090:The Circumference of the Circle(计算几何,求三角形外心)
The Circumference of the Circle Time Limit: 2 Seconds Memory Limit: 65536 KB To calculate the c ...
- ZOJ 1090 The Circumference of the Circle
原题链接 题目大意:已知三角形的三个顶点坐标,求其外接圆的周长. 解法:刚看到这道题时,马上拿出草稿纸画图,想推导出重心坐标,然后求出半径,再求周长.可是这个过程太复杂了,写到一半就没有兴致了,还是求 ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1025解题报告
ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...
- ZOJ Problem Set - 3829Known Notation(贪心)
ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...
- ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】
称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...
- ZOJ Problem Set - 3593 拓展欧几里得 数学
ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...
- ZOJ Problem Set - 2297 Survival 【状压dp】
题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...
- ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】
题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...
随机推荐
- python三种导入模块的方法和区别
方法一: import modname 模块是指一个可以交互使用,或者从另一Python 程序访问的代码段.只要导入了一个模块,就可以引用它的任何公共的函数.类或属性.模块可以通过这种方法来 使用其它 ...
- hdu2577 dp
也可以字符串搞.dp思路还是很清晰的.dp[][0]表示未锁定,dp[][1]表示锁定键. #include<stdio.h> #include<string.h> #defi ...
- jQuery 图片高亮显示
主要的jQuery代码: $(function() { $("ul li").hover(function() { // over //鼠标移入当前列透明度为1 其他列为0.5 $ ...
- php 练习 1
php5 echo 和 print 语句 在PHP 中, 有两种基本的输出方法:echo 和print . 在本教程中,我们几乎在每个例子中都会用到echo和print.因此,本节为您讲解更多关于这两 ...
- jenkins集成错误 标签: 发布 2016-01-10 20:45 747人阅读 评论(21) 收藏
进入ITOO的项目以后,终于要将自己负责的模块在jenkins上面集成发布了.首先自己按照文档要求一步一步的将配置完成,然后构建,不错所料出错了,经过修改,终于构建成功!构建成功以后就没再管了,结果第 ...
- @atcoder - AGC037F@ Counting of Subarrays
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定 L,连续至少 L 个相同的数 k 可以合并成 1 个 k+ ...
- @atcoder - AGC036D@ Negative Cycle
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个 N 个点的有向带权图,从 0 编号到 N - 1.一开 ...
- HZOJ 礼物
其实是比较简单的一道期望状压dp,考试时一直在想数组表示概率,然而最后出的数总是小于一,于是无奈的把第一个点判掉放弃了其他点. 设f[i]为状态为i时到全部买到的期望次数,$f[i]=∑f[j]*p[ ...
- H3C 错误提示信息
- 获取checkbox返回值
<div class="checkbox"> <label> <input type="checkbox" value=" ...