LightOJ 1043 - Triangle Partitioning
See the picture below.
You are given AB
, AC
and BC
. DE
is parallel to BC
. You are also given the area ratio between ADE
and BDEC
. You have to find the value of AD
.
水题;
说一下题意
两个相似三角形ADE
和ABC
,给出AB
,AC
,BC
的长度以及三角形ADE
和四边形DECB
的比值,求AD
的长度。
#include<bits/stdc++.h>
using namespace std;
double solve()
{
double a, b, c, d;
cin >> a >> b >> c >> d;
d = sqrt(d / (d + 1));
return a * d;
}
int main()
{
//ios::sync_with_stdio(false);
int t;
cin >> t;
for(int i=0; i<t; ++ i)
printf("Case %d: %.8f\n", i+1, solve());
return 0;
}