HDU1700 Points on Cycle (最大内接三角形)
来源:互联网 发布:ubuntu识别u盘设备 编辑:程序博客网 时间:2024/06/09 20:15
题目链接:
http://acm.hdu.edu.cn/showproblem.php?pid=1700
题意:
一个圆心为原点的圆,告诉你圆上一点,求圆上另外两点的坐标使圆的面积最大
分析:
三角形的面积由底边和高两个因素决定,不管底边所在弦有多少,
但其高只有经过圆心的为最大,
故毫无质疑必须是等腰三角形。
设等腰三角形ABC,高AH,圆心O,AO=BO=R,OH=AH-AO,设高为x,
BH=√[R^2-(x-R)^2]=√(2Rx-x^2),
∴S=x√(2Rx-x^2),
dS=√(2Rx-x^2)+(1/2)*(2Rx-x^2)^(-1/2)*(2R-2x)*x=(2Rx-x^2+Rx-x^2)/√(2Rx-x^2)=0,
2x^2-3Rx=0,
x=3R/2,根据实际问题,该驻点有极大值,
即当x=3R/2时有最大面积,而高AH=3R/2,正是正三角形,
∴当圆内接正三角形时具有最大面积。
但其高只有经过圆心的为最大,
故毫无质疑必须是等腰三角形。
设等腰三角形ABC,高AH,圆心O,AO=BO=R,OH=AH-AO,设高为x,
BH=√[R^2-(x-R)^2]=√(2Rx-x^2),
∴S=x√(2Rx-x^2),
dS=√(2Rx-x^2)+(1/2)*(2Rx-x^2)^(-1/2)*(2R-2x)*x=(2Rx-x^2+Rx-x^2)/√(2Rx-x^2)=0,
2x^2-3Rx=0,
x=3R/2,根据实际问题,该驻点有极大值,
即当x=3R/2时有最大面积,而高AH=3R/2,正是正三角形,
∴当圆内接正三角形时具有最大面积。
已知A(a,b), 设B(x,y),,
cos(2pi/3)=向量OA*向量OB/|OA|*|OB|;
( ax+b*y ) = -1/2 * R*R; --------1)
a*a + b*b = R*R; -----------2)
x*x + y*y = R*R -----------3)
一二三式联立可以解出两个点的坐标,注意x=0的时候
代码如下:
#include <iostream>#include <cstring>#include <cstdio>#include <cmath>using namespace std;int main(){ int t; scanf("%d",&t); while(t--){ double x1,y1,r; scanf("%lf%lf",&x1,&y1); r = x1*x1+y1*y1; double a = 1; double b = y1; double c = r/4-x1*x1; double delta = b*b-4*a*c; double ansy1 = (-b-sqrt(delta))/2/a; double ansy2 = (-b+sqrt(delta))/2/a; double ansx1,ansx2; if(fabs(x1)<=1e-7){ ansx1 = -sqrt(r-ansy1*ansy1); ansx2 = sqrt(r-ansy2*ansy2); } else{ ansx1 = (-r/2-y1*ansy1)/x1; ansx2 = (-r/2-y1*ansy2)/x1; } printf("%.3lf %.3lf %.3lf %.3lf\n",ansx1,ansy1,ansx2,ansy2); } return 0;}
0 0
- HDU1700 Points on Cycle (最大内接三角形)
- HDU1700:Points on Cycle
- hdu1700 Points on Cycle (数学)
- HDU1700 Points on Cycle(感觉很重要)
- HDU 1700 Points on Cycle
- HDU-1700 Points on Cycle
- hdu 1700 Points on Cycle 水几何
- 【计算几何】 HDOJ 1700 Points on Cycle
- hdu 1700 Points on Cycle(几何)(中等)
- POJ 2079 凸包最大内接三角形
- hdu 1700(圆最大内接三角形)
- 1730数字三角形问题(三角形内路径最大)
- HDU 1700 || Points on Cycle (向量旋转,圆上等边三角形的周长最长
- HDU 3934 Summer holiday & Poj 2079 Triangle(凸包最大内接三角形)
- hdu 3934 Summer holiday(凸包最大内接三角形)
- codeforces251A. Points on Line
- CF251A. Points on Line
- codeforces251A. Points on Line
- FZU Problem 2150 Fire Game (双起点BFS啊 )
- 跟我一起写makefile 十
- Intersection of Two Linked Lists
- 跟我一起写makefile 十一
- 类型转换
- HDU1700 Points on Cycle (最大内接三角形)
- 华东交通大学2014年ACM“双基”程序设计竞赛解题报告
- 数据结构第六章图
- 属性封装和继承
- can't link with a main executable file for architecture armv7
- 跟我一起写makefile 十二
- Android中Activity四种启动模式和taskAffinity属性详解
- 跟我一起写makefile十三
- 跟我一起写makefile十四