The areaProblem Description
Ignatius bought a land last week, but he didn't know the area of the land because the land is enclosed by a parabola and a straight line. The picture below shows the area. Now given all the intersectant points shows in the picture, can you tell Ignatius the area of the land?
Note: The point P1 in the picture is the vertex of the parabola. ![]() |
Input
The input contains several test cases. The first line of the input is a single integer T which is the number of test cases. T test cases follow.
Each test case contains three intersectant points which shows in the picture, they are given in the order of P1, P2, P3. Each point is described by two floating-point numbers X and Y(0.0<=X,Y<=1000.0). |
Output
For each test case, you should output the area of the land, the result should be rounded to 2 decimal places.
|
Sample Input
2 5.000000 5.000000 0.000000 0.000000 10.000000 0.000000 10.000000 10.000000 1.000000 1.000000 14.000000 8.222222 |
Sample Output
33.33 40.69 |
Author
Ignatius.L
题目大意:求如图阴影部分面积。(数学水题)
首先看到题目啦,抛物线和直线相交,只求所围图形的面积。我们想到了啥呢?当然是化简计算啦!!!(会偷懒的人事半功倍~)
首先,推翻它的坐标系。以P2为原点,原x轴方向为正方向做平面直角坐标系。设抛物线:y = a x² + b x 。 其次,把握顶点的对称。由对称轴为x₁有:b = -a x₁ 。带入(x₁,y₁)得:a = -y₁/x₁ b = 2 y₁/x₁ 。
直观,积分得阴影面积。S = ∫(x₂->0)(a x² + b x - y₂/x₂ x)dx (计算时 y₂ 用x₁、y₁、x₂ 表示)
最后,积分出来的时候是不是很激动呢?只用了简单的几个未知量呢~(斜眼笑)
S =
y
₁ × x₂³ ÷ 6x
₁ ² (数学版 woc )= 1/6*y1*x2*x2*x2/x1/x1 (程序员版) 。
好吧,说到底就是一道积分水题喽,不要算错就好啦
≡ ̄﹏ ̄≡
|
hdu 1071 ACM steps The area
最新推荐文章于 2019-11-16 17:23:11 发布