hdu 1700 (圆的内接三角形 要周长最大)
以原点为圆心,给出圆上的一点,要求圆上的另外两点,使得这三个点的距离和最大,很容易想到这是一个等边三角形
然后有这两个公式 点a为已知点
a*b=|a|*|b|*cos(120);
x*x+y*y=r*r;

Sample Input
2
1.500 2.000
563.585 1.251
Sample Output
0.982 -2.299 -2.482 0.299
-280.709 -488.704 -282.876 487.453
# include <iostream>
# include <cstdio>
# include <cstring>
# include <algorithm>
# include <cmath>
# include <queue>
# define LL long long
using namespace std ; int main ()
{
//freopen("in.txt","r",stdin) ;
int T ;
scanf("%d" , &T) ;
while(T--)
{
double x , y , x1 , y1 , x2 , y2 , a ,b ,c , r;
scanf("%lf %lf" , &x , &y) ;
r = sqrt(x*x + y*y) ;
a = r * r ;
b = r * r * y ;
c = (r*r*r*r-*x*x*r*r)/4.0 ;
y1 = (-1.0*b - sqrt(b*b - *a*c))/(*a) ;
y2 = (-1.0*b + sqrt(b*b - *a*c))/(*a) ;
if (fabs(x-) < 1e-)
{
x1 = -sqrt(r*r - y1*y1) ;
x2 = sqrt(r*r - y2*y2) ;
}
else
{
x1 = (-r*r/-y*y1)/x ;
x2 = (-r*r/-y*y2)/x ;
}
printf("%.3lf %.3lf %.3lf %.3lf\n" , x1 , y1 , x2 , y2) ; } return ;
}
hdu 1700 (圆的内接三角形 要周长最大)的更多相关文章
- HDU 1700 Points on Cycle (坐标旋转)
题目链接:HDU 1700 Problem Description There is a cycle with its center on the origin. Now give you a poi ...
- HDU 3511 圆扫描线
找最深的圆,输出层数 类似POJ 2932的做法 圆扫描线即可.这里要记录各个圆的层数,所以多加一个维护编号的就行了. /** @Date : 2017-10-18 18:16:52 * @FileN ...
- python脚本1_给一个半径求圆的面积和周长
#给一个半径,求圆的面积和周长,圆周率3.14 r = int(input('r=')) print('area='+str(3.14*r*r)) print('circumference='+str ...
- HDU 1700 Points on Cycle (几何 向量旋转)
http://acm.hdu.edu.cn/showproblem.php?pid=1700 题目大意: 二维平面,一个圆的圆心在原点上.给定圆上的一点A,求另外两点B,C,B.C在圆上,并且三角形A ...
- hdu 1700 Points on Cycle(坐标旋转)
http://acm.hdu.edu.cn/showproblem.php?pid=1700 Points on Cycle Time Limit: 1000/1000 MS (Java/Others ...
- HDU 1828 Picture (线段树+扫描线)(周长并)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1828 给你n个矩形,让你求出总的周长. 类似面积并,面积并是扫描一次,周长并是扫描了两次,x轴一次,y ...
- HDU 1828 Picture(长方形的周长和)
HDU 1828 Picture 题目链接 题意:给定n个矩形,输出矩形周长并 思路:利用线段树去维护,分别从4个方向扫一次,每次多一段的时候,就查询该段未被覆盖的区间长度,然后周长就加上这个长度,4 ...
- HDU 1392 Surround the Trees (凸包周长)
题目链接:HDU 1392 Problem Description There are a lot of trees in an area. A peasant wants to buy a rope ...
- 【HDU 1828】 Picture (矩阵周长并,线段树,扫描法)
[题目] Picture Problem Description A number of rectangular posters, photographs and other pictures of ...
随机推荐
- CodeForces - 707C
C. Pythagorean Triples time limit per test 1 second memory limit per test 256 megabytes input standa ...
- IDEA中新建Module时Module name、Content root、Module file location的含义
如下图测试: 最开始默认情况下,Content root.Module file location两行,最末尾的数据跟Module name是相同的. 现在对三行数据,强制进行不同的命名,Finish ...
- 【刷题】BZOJ 4945 [Noi2017]游戏
Description http://www.lydsy.com/JudgeOnline/upload/Noi2017D2.pdf Solution 字符串里的'x'看起来很烦,于是考虑枚举这些'x' ...
- 洛谷 P1412 经营与开发 解题报告
P1412 经营与开发 题目描述 \(4X\)概念体系,是指在\(PC\)战略游戏中一种相当普及和成熟的系统概念,得名自4个同样以"\(EX\)"为开头的英语单词. \(eXplo ...
- 前端学习 -- Html&Css -- 相对定位 绝对定位 固定定位
相对定位 - 定位指的就是将指定的元素摆放到页面的任意位置,通过定位可以任意的摆放元素. - 通过position属性来设置元素的定位. -可选值: static:默认值,元素没有开启定位: rela ...
- [SDOI2009]Bill的挑战——全网唯一 一篇容斥题解
全网唯一一篇容斥题解 Description Solution 看到这个题,大部分人想的是状压dp 但是我是个蒟蒻没想到,就用容斥切掉了. 并且复杂度比一般状压低, (其实这个容斥的算法,提出来源于y ...
- eclipse java build path问题汇总
背景:在项目开发过程中,很多应用都进行了模块划分,有的时候是jar包依赖,有的时候通过build path进行配置,搞清楚这部分有助于理解项目之间的关系. 1 tms项目开发 1.1 问题描述 项目结 ...
- First non-repeating character in a stream
First non-repeating character in a stream Given an input stream of n characters consisting only of s ...
- RabbitMQ服务主机名更改导致消息队列无法连接
RabbitMQ服务主机名更改导致消息队列无法连接 在多节点环境中,RabbitMQ服务使用一个独立节点部署.在此环境下,如果修改了RabbitMQ节点的主机名,则需要更新RabbitMQ用户才能保证 ...
- 集合框架基础知识-----java基础知识
Java集合框架 :接口:Collection.List .Set. Map:实现类:ArrayList.LinkedList.Vector.HashSet.TreeSet.HashMap.HashT ...