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 题 ...
随机推荐
- JavaScript--淘宝图片切换
css样式有点问题,但是主要是js逻辑: <!DOCTYPE html> <html> <head> <meta charset="utf-8&qu ...
- Java练习 SDUT-2728_最佳拟合直线
最佳拟合直线 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 在很多情况下,天文观测得到的数据是一组包含很大数量的序列点 ...
- js错误处理Try-catch和throw
1.try-catch语句 Try{ //可能会导致错误的代码 }catch(error){ //在错误发生时怎么处理 } 例如: try{ window.someNonexistentFunct ...
- 1月房地产企业销售TOP100出炉 万科重回第一
1月房地产企业销售TOP100出炉 万科重回第一 2017-02-05 07:40:32 来源:腾讯新闻 责任编辑: [摘要]TOP100房企1月的销售金额合计4311.8亿元,销售面积合计3648. ...
- es6 默认参数、rest参数、扩展运算符
1.默认值 现在可以在定义函数的时候指定参数的默认值了,而不用像以前那样通过逻辑或操作符来达到目的了. function sayHello(name){ //传统的指定默认参数的方式 var name ...
- 网上很多laravel中cookie的使用方法。
https://blog.csdn.net/chen529834149/article/details/75244718 概述 Cookie的添加其实很简单,直接使用Cookie::make(),在使 ...
- Mysql 锁表处理
-- 查看正在被锁定的的表 show ; -- 查看进程号 show processlist; -- 杀掉进程 : -- 表级锁次数 show status like 'Table%'; +----- ...
- Sublime插件:增强篇
Sublime Text 如何安装插件详见:https://packagecontrol.io/installation WordCount:可以实时显示当前文件的字数. 安装后,后下角多出字数 En ...
- POJ2186 Popular Cows 题解 强连通分量入门题
题目链接:http://poj.org/problem?id=2186 题目大意: 每头牛都想成为牛群中的红人. 给定N头牛的牛群和M个有序对(A, B),(A, B)表示牛A认为牛B是红人: 该关系 ...
- CODE FESTIVAL 2017 qual A C Palindromic Matrix(补题)
彩笔看到题目后,除了懵逼,没有啥反应了,唯一想的就是 这是不是dp啊?看了题解才发现,原来是这样啊. 画几个矩阵看看就能看出来规律. 思路:先假设这是个M * N的矩阵 如果M和N都是偶数,则每个出现 ...