博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
二分--1043 - Triangle Partitioning
阅读量:4691 次
发布时间:2019-06-09

本文共 1414 字,大约阅读时间需要 4 分钟。

1043 - Triangle Partitioning
Time Limit: 0.5 second(s) Memory Limit: 32 MB

See the picture below.

You are given ABAC and BCDE is parallel to BC. You are also given the area ratio between ADE and BDEC. You have to find the value of AD.

Input

Input starts with an integer T (≤ 25), denoting the number of test cases.

Each case begins with four real numbers denoting AB, AC, BC and the ratio of ADE and BDEC (ADE / BDEC). You can safely assume that the given triangle is a valid triangle with positive area.

Output

For each case of input you have to print the case number and AD. Errors less than 10-6 will be ignored.

Sample Input

Output for Sample Input

4

100 100 100 2

10 12 14 1

7 8 9 10

8.134 9.098 7.123 5.10

Case 1: 81.6496580

Case 2: 7.07106781

Case 3: 6.6742381247

Case 4: 7.437454786

 


PROBLEM SETTER: JANE ALAM JAN

题目大意很明显,求AD 

思路:对AD二分  注意边和面积是平方的倍数关系(S=sqrt(p(p-a)(p-b)(p-c)) p=(a+b+c)/2 就能看出来了)

当然这题也可以找关系直接做出来

#include
#include
#define eps 1e-9#define min(a,b) ((a)<(b)?(a):(b))int main(){ int t; double a,b,c,high,low,mid; scanf("%d",&t); double kk;// cout<
eps){ mid=(high+low)/2; if((mid/a)*(mid/a)>kk/(1+kk)) //找对关系式 high=mid; else low=mid; } printf("Case %d: %.8lf\n",i,mid); } return 0;}

版权声明:本文为博主原创文章,未经博主允许不得转载。

posted on
2014-08-05 10:52 阅读(
...) 评论(
...)

转载于:https://www.cnblogs.com/france/p/4808685.html

你可能感兴趣的文章
sql server 2008学习8 sql server存储和索引结构
查看>>
Jquery radio选中
查看>>
postgressql数据库中limit offset使用
查看>>
测试思想-集成测试 关于接口测试 Part 2
查看>>
windows下mysql密码忘了怎么办?【转】
查看>>
php生成器使用总结
查看>>
T-SQL中的indexof函数
查看>>
javascript基础之数组(Array)对象
查看>>
mysql DML DDL DCL
查看>>
RAMPS1.4 3d打印控制板接线与测试1
查看>>
python with语句中的变量有作用域吗?
查看>>
24@Servlet_day03
查看>>
初级ant的学习
查看>>
redis数据结构--String
查看>>
POJ 3279 Fliptile (二进制枚举)
查看>>
memcached 细究(三)
查看>>
future
查看>>
关于main函数传参数的问题
查看>>
getTickCount()函数 VS GetTickCount()函数
查看>>
嵌入式jetty
查看>>