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 题 ...
随机推荐
- Linux下的python安装
centos7安装python3 以及tab补全功能 1.安装python3 1.1下载python源码包 网址:https://www.python.org/downloads/release/ ...
- 使用 Markdown Flow 画流程图
使用 Markdown Flow 画流程图 好处是可以方便的使用 Git 管理版本 st=>start: 开始 e=>end: 结束 c1=>condition: A c2=> ...
- Uva 10074【递推dp】
UVa 10074 题意:求01矩阵的最大子0矩阵. http://www.csie.ntnu.edu.tw/~u91029/MaximumSubarray.html#2 这里说的很清楚.先求Larg ...
- 04使用harbor配置私仓
安装harbor之前,需要安装好Python,Docker,DockerCompose.Python需要2.7以上的版本,Docker需要1.10以上的版本:Docker Compose 需要1.6. ...
- LeetCode69 Sqrt(x)
题意: Implement int sqrt(int x). Compute and return the square root of x.(Medium) 分析: 二分搜索套路题,不能开方开尽的时 ...
- APICloud ajax请求api数据问题
云编译开启全局加密的情况下,请务必使用api.ajax,避免使用JQ等框架的ajax,否则将引起请求失败.官网API说明链接 还要就是要注意用$.ajax请求数据时会出现的同源策略问题.
- day7_python之面向对象高级-反射
反射:通过字符串去找到真实的属性,然后去进行操作 python面向对象中的反射:通过字符串的形式操作对象相关的属性.python中的一切事物都是对象(都可以使用反射) 1.两种方法访问对象的属性 cl ...
- php 第三方登录总结OAuth协议
- oracle不明确的索引等级
当ORACLE无法判断索引的等级高低差别,优化器将只使用一个索引,它就是在WHERE子句中被列在最前面的. 举例: DEPTNO上有一个非唯一性索引,EMP_CAT也有一个非唯一性索引. SELECT ...
- Python--day71--分页功能
分页功能代码: from django.shortcuts import render # Create your views here. from app01 import models def b ...