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;
}
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步