uva 11524 - InCircle (二分法)
题意:三角形ABC的内切圆把它的三边分别划分成 m1:n1,m2:n2 和 m3:n3 的比例。另外已知内切圆的半径 r ,求三角形ABC 的面积。
![]() |
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#define sqr(a) (a)*(a)
#define eps 1e-12
#define min(a,b) a<b?a:b
#define max(a,b) a>b?a:b
#define pi asin(1.0) using namespace std; int sig(double a)
{
return (a>eps)-(a<-eps);
} int main()
{
int t;
double r,m1,n1,m2,n2,m3,n3,k1,k2,k3;
double left,right,mid,thy,th1,th2,th3;
cin>>t;
while(t--)
{
cin>>r>>m1>>n1>>m2>>n2>>m3>>n3;
k1=sqr(n1);
k2=sqr(n2/m2)*k1;
k3=sqr(m1);
left=min(sqrt(3/k1)*r,sqrt(3/k2)*r);
left=min(left,sqrt(3/k3)*r);
right=max(sqrt(3/k1)*r,sqrt(3/k2)*r);
right=max(right,sqrt(3/k3)*r);
mid=(left+right)/2;
while(sig(right-left)>0)
{
th1=r/sqrt(k1*sqr(mid)+sqr(r));
th2=r/sqrt(k2*sqr(mid)+sqr(r));
th3=r/sqrt(k3*sqr(mid)+sqr(r));
thy=asin(th1)+asin(th2)+asin(th3);
int f=sig(thy-pi);
if(f==0) break;
else if(f<0) right=mid;
else left=mid;
mid=(left+right)/2;
}
thy=2*asin(r/sqrt(k1*sqr(mid)+sqr(r)));
double area=(n1+m1)*mid/2*(n2+m2)*n1/m2*mid*sin(thy);
cout<<fixed<<setprecision(4)<<area<<endl;
}
return 0;
}
uva 11524 - InCircle (二分法)的更多相关文章
- UVa 11524:In-Circle(解析几何)
Problem EIn-CircleInput: Standard Input Output: Standard Output In-circle of a triangle is the circl ...
- UVa 11524 - InCircle
推公式 #include <cstdio> #include <cmath> double Cal( double a, double b, double c ) { retu ...
- ACM计算几何题目推荐
//第一期 计算几何题的特点与做题要领: 1.大部分不会很难,少部分题目思路很巧妙 2.做计算几何题目,模板很重要,模板必须高度可靠. 3.要注意代码的组织,因为计算几何的题目很容易上两百行代码,里面 ...
- UVA 3890 Most Distant Point from the Sea(二分法+半平面交)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=11358 [思路] 二分法+半平面交 二分与海边的的距离,由法向量可 ...
- uva 714 Copying Books(二分法求最大值最小化)
题目连接:714 - Copying Books 题目大意:将一个个数为n的序列分割成m份,要求这m份中的每份中值(该份中的元素和)最大值最小, 输出切割方式,有多种情况输出使得越前面越小的情况. 解 ...
- uVa 714 (二分法)
Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Description Before th ...
- UVA 12097 LA 3635 Pie(二分法)
Pie My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a numbe ...
- uva live 6190 Beautiful Spacing (二分法+dp试 基于优化的独特性质)
I - Beautiful Spacing Time Limit:8000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu ...
- UVA 10668 - Expanding Rods(数学+二分)
UVA 10668 - Expanding Rods 题目链接 题意:给定一个铁棒,如图中加热会变成一段圆弧,长度为L′=(1+nc)l,问这时和原来位置的高度之差 思路:画一下图能够非常easy推出 ...
随机推荐
- 解决mongodb连接失败问题
错误提示: MongoDB shell version: 2.4.9 connecting to: test Mon Mar 3 23:45:09.491 Error: couldn't conne ...
- Paper.js - Paper.js
Paper.js - Paper.js Paper.js is an open source vector graphics scripting framework that runs on to ...
- UVA 100 - The 3n+1 problem (3n+1 问题)
100 - The 3n+1 problem (3n+1 问题) /* * 100 - The 3n+1 problem (3n+1 问题) * 作者 仪冰 * QQ 974817955 * * [问 ...
- m元素集合的n个元素子集
理论: 假设有5个元素的集点,取出3个元素的可能子集如下:{1 2 3}.{1 2 4 }.{1 2 5}.{1 3 4}.{1 3 5}.{1 4 5}.{2 3 4}.{2 3 5}.{2 4 5 ...
- JavaScript原型链与继承
最近学习了<Javascript高级程序设计>面向对象部分,结合书中的例子总结一下原型链和继承部分的内容. 创建对象 在Js当中没有类这个概念,当我们想要创建具有相同属性的对象的时候,有如 ...
- Young Table(暴力,交换位置)
Young Table Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submi ...
- 在浏览器中输入Google.com并且按下回车之后发生了什么?
作者: skyline75489 来源: skyline75489的博客 发布时间: 2015-03-26 16:57 阅读: 4163 次 推荐: 23 原文链接 [收藏] ...
- hpux操作系统的关机与重新启动命令
关机 shutdown -hy 0 重新启动: shutdown -ry 0
- 【数学三角恒等变幻】【HDU2552】三足鼎立
Problem Description MCA山中人才辈出,洞悉外界战火纷纷,山中各路豪杰决定出山拯救百姓于水火,曾以题数扫全场的威士忌,曾经高数九十九的天外来客,曾以一剑铸十年的亦纷菲,歃血为盟,盘 ...
- jQuery UI的基本使用方法与技巧
一.概述 jQuery UI is a widget and interaction library built on top of the jQuery JavaScript Library, th ...
