几何375 内接圆和等腰三角形

题目:

Circumferences周长inscribedcircles内接圆

Given two real numbers

B the width of the base of an isoscelestriangle等腰三角形 in inches

H the altitude高 of the sameisosceles triangle in inches

Compute to six significant decimal places小数位数

C the sum of the circumferences周长 of aseries of inscribed circles内接圆 stacked one on top of another from the base to the peak; such thatthe lowest inscribed circle is tangent相切 to the base and the two sides

and the next higher inscribed circle istangent to the lowestinscribed circle and the two sides, etc. In order to keep the timerequired to compute the result within reasonable bounds, you may limit theradius半径 of the smallest inscribed circle in the stack to a single precision精度 floatingpoint value of 0.000001.

For those whose geometry and trigonometry几何和三角 are abit rusty, the center of an inscribed circle is at the point of intersection交点 of thethree angular bisectors角等分线(中线).

The input begins with a single positiveinteger on a line by itself indicating the number of the cases following, eachof them as described below.

This line is followed by a blank line, andthere is also a blank line between two consecutive inputs.

The input will be a single line of textcontaining two positive single precision real numbers (B H) separated byspaces.

Output For each test case, the output mustfollow the description below. The outputs of two consecutive cases will beseparated by a blank line. The output should be a single real number withtwelve significant digits, six of which follow the decimal point. The decimalpoint must be printed in column 7.

角平分线是内接圆,中垂线是外接圆(等腰三角形的中线垂直底边)

求内接圆半径:过圆心作三条线段分别与三角形三条边a、b、c垂直,这时三角形面积可以用三个小三角形来求,
既a*r/2+b*r/2+c*r/2=(a+b+c)*r/2=S

所以r=2S/(a+b+c)

A^2=(1/2*b)^2+h^2勾股定理求斜边长

r=bh/(b+2a)

C=2*PAI*r

H1=h-2*r

B1= b*h1/h B1/B=h1/h三角形相似比算下一代底边长

debug过程

输出格式问题:%n.mf  即输出总共占n位其中有m位小数

//0.263451
#include<stdio.h>
#include<math.h>
#define PAI 4.0*atan(1.0)
//#define LOCAL
int main(){#ifdef LOCALfreopen("data.in","r",stdin);freopen("data.out","w",stdout);#endifint n,i,flag=1;//样例组数,首行标志 double b,h,h1,sum=0,a,r; scanf("%d",&n);for(i=0;i<n;i++){scanf("%lf %lf",&b,&h);sum=0;while(1){a=sqrt(0.25*b*b+h*h);r=b*h/(b+2*a);if(r<0.000001)break;sum+=2*PAI*r;h1=h-2*r;b=b*h1/h;h=h1;
//          printf("%f\n",sum);}if(flag) flag=0;else printf("\n");printf("%13.6lf\n",sum);       }return 0;
}

也是udebug完全一致,提交后WA。

改变PAI的定义为atan就AC了

Uva375 内接圆和等腰三角形相关推荐

  1. UVa 375 内接圆和等腰三角形

    /* * 解题思路: * 题意不难理解.一直求内接圆半径.知道半径长度小于0.000001为止 */ #include <math.h> #include <stdio.h> ...

  2. 375 Inscribed Circles and Isosceles Triangles 等腰三角形 内接圆 圆周率PI表示

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&p ...

  3. SGU 332 Largest Circle(凸包内接圆半径nlogn)

    题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=332 题意:逆时针给出一个凸包,给凸包的最大内接圆半径. 思路:nlogn的算法: ...

  4. opencv 最大内接矩形_OpenCV之二值图像分析 – 寻找最大内接圆

    python代码: from __future__ import print_function from __future__ import division import cv2 as cv imp ...

  5. 轮廓的最大面积内接矩形/内接圆计算

    1.求出轮廓重心(X0,Y0). 2.找出轮廓上点到重心的距离最大的点1. 3.连接点到重心形成线段,做线段反向等距离延长线段,得到点2. 4.内接矩形:根据对角线上的(点1,点2),根据旋转矩形和平 ...

  6. 牛题:等边三角形内接圆上一点到三顶点距离平方和不变

    如图,等边三角形ABC,P为三角形内接圆上一点.求证,AP^2 + BP^2 + CP^2为常数. 证明:把整个图形放在三维空间里,其中A=(1,0,0),B=(0,1,0),C=(0,0,1).因此 ...

  7. python画正方形内切圆_任意多边形最大内接圆算法的Python实现,内切圆

    初衷是为了求裂缝的最大宽度 直接上代码 import random import cv2 import math import numpy as np from numpy.ma import cos ...

  8. 四边形内接于圆定理_中考数学提分36计之第19计思维模型助你轻松搞定圆问题,提分必备...

    A.思维模型综述 圆是初中数学知识的大综合,不论是代数还是几何,所有的知识几乎都能在圆中体现.新课标以来圆的部分内容在中考中的地位有所下降,题目难度有所降低,但是圆的命题还是中考的热点考题,在不少地区 ...

  9. 二维几何基础大合集!《计算几何全家桶(一)》(基础运算、点、线、多边形、圆、网格)

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的模板整合计划 目录 1.基本运算 1.1 判断正负函数(sgn) 1.2 点积(数量积.内积)(Dot) 1.3 向量积 ...

  10. OPENCV 寻找图形最大内接矩形

      轮廓的最大外接矩形,Opencv有提供的现成的算法,最大内接圆也有提供的算法.但是没有现成的内接矩形的算法.本文使用C++实现了取轮廓最大内接矩形的方式,供大家参考. 实现的基本思路是: 处理图片 ...

最新文章

  1. linux系统预定义变量有哪些,Shell预定义变量用法详解
  2. oracle tochar fm,oracle的to_char中的fm
  3. Python多任务(7.多进程的应用:文件的拷贝器例子)
  4. HawtIO在JBoss EAP上(第二部分)
  5. python AttributeError: 'module' object has no attribute 'dumps'解决办法
  6. Centos/Linux 源码安装wireshark与tshark任意版本
  7. 《动手学深度学习》入门环境安装
  8. Bitvise Tunnelier 安装教程及报错处理
  9. 提供全套Python教学资源和考试系统,全力打造良心服务
  10. 【论文解读】Stacked Hourglass Networks
  11. 计算机怎么移动游戏,Uplay游戏怎么搬移 Uplay游戏搬移方法介绍
  12. 记录:前端js实现页面内简繁体切换
  13. Java内存溢出排查(必看)
  14. 【Java】文如何制作帮助文档
  15. 编程语言C语言用中文代写方法,C语言中如何输入汉字,C语言乱码详细解答
  16. java全栈系列之JavaSE-面向对象(super详解)036
  17. 算法梳理(三)决策树
  18. 关于zheng项目的学习步骤{ 转载 }
  19. 杭州招银网络科技面经
  20. chkdsk 命令对Raid盘检测和查错、修复

热门文章

  1. 宗宁:企业微博品牌榜的新时代意义
  2. 国外10个最佳和最流行的酷站推荐网站
  3. ITK VKT 安装-详细
  4. PostgreSQL中文手册
  5. Windows Mobile 6 中为开发人员提供的新功能
  6. 【常识】常用RGB颜色对照表
  7. oracle静默安装报错,静默安装oracle时报错
  8. 服务器上怎么强制删除文件夹,Windows10系统强制删除文件的方法
  9. 群联固态硬盘修复工具_固态硬盘有三大要素,那么你的固态硬盘买对了吗?
  10. Squid 代理服务器应用