LightOJ 1043 - Triangle Partitioning

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\n", i+1, solve());
	return 0;
}

posted @ 2017-04-12 21:44  aiterator  阅读(113)  评论(0编辑  收藏  举报