LightOJ 1043

See the picture below.

image

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.

水题;

说一下题意

两个相似三角形ADEABC,给出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
", i+1, solve());
	return 0;
}

原文地址:https://www.cnblogs.com/aiterator/p/6701542.html