zoj-2559 The Smart Bomb 简单几何
来源:互联网 发布:windows 体验指数 编辑:程序博客网 时间:2024/06/14 17:54
可以看出:最大的三个圆正好只可能是在三角形最小两个边只和。
设有r1,r2,r3为三个圆的半径,d1,d2,d3,是三角形的边,且d3是最长的边。
则有:r1+r2=d1,r2+r3=d2;====>r1-r3=d1-d2;
又因:r1+r3<=d3,因为必须保证三个圆不能相交,且r1,r2,r3尽可能大。
代入:r1=(d1+d3-d2)/2.代入即可求得其他两个圆的半径。
代码:
#include<cmath> #include<cstdio>#include<cstring>using namespace std ;double dis(double a,double b,double c,double d){return sqrt((a-c)*(a-c)+(b-d)*(b-d));}int main(){double x1,x2,x3,y1,y2,y3;double d1,d2,d3,r1,r2,r3; while(scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3)!=EOF){ d1=dis(x1,y1,x2,y2); d2=dis(x2,y2,x3,y3); d3=dis(x1,y1,x3,y3); r1=(d3+d1-d2)/2; r2=(d1+d2-d3)/2; r3=(d2+d3-d1)/2; printf("%.6lf\n",r1); printf("%.6lf\n",r2); printf("%.6lf\n",r3); } return 0 ;}
- zoj-2559 The Smart Bomb 简单几何
- ZOJ Defuse the Bomb
- zoj Defuse the Bomb (模拟)
- zoj 3938 Defuse the Bomb
- ZOJ 3938 Defuse the Bomb
- zoj-3938-Defuse the Bomb
- ZOJ Problem Set - 3938 Defuse the Bomb
- ZOJ 3938 Defuse the Bomb(水题)
- ZOJ 3728 Collision 简单几何
- ZOJ-3919-Ellipse【简单几何】
- ZOJ 3938 Defuse the Bomb(水题/细心模拟)
- ZOJ 1721 The Doors dijstra+计算几何
- ZOJ 146 - The 13th Zhejiang Provincial Collegiate Programming Contest - C Defuse the Bomb
- zoj 2873 Smart Sister
- ZOJ 2873 Smart Sister
- ZOJ 3938-Defuse the Bomb【模拟,题看着挺长】(2016浙江省大学生程序设计竞赛)
- ACM刷题之ZOJ————Defuse the Bomb
- ZOJ 1721 The Doors (计算几何+dijkstra)
- EditText不常用属性
- Robot Framework 安装
- 使用Myeclipse插件将wsdl生成java客户端代码
- spice server qxl red_worker_main()代码分析
- 招聘实习生,要求懂java开发
- zoj-2559 The Smart Bomb 简单几何
- glUseProgram
- 【EXE PE】初识pe结构--手写可执行程序
- 容器做参数,传地址
- canal和otter的关系?
- Map 和 Set 的遍历运用
- [ios]各种证书
- JUnit in Action Second Edition-20130906
- SVN中更改连接用户