Lightoj 1178 : Problem Link
In this problem, we are given the lengths of the four sides of a trapezium. We need to calculate its area.
We know the formula for the area of a trapezium is:
That is:
Here:
-
and are the lengths of the parallel sides.
-
is the height (perpendicular distance between and ).
We are given and , but not . So, we need to calculate .
Step 1: Drop perpendiculars
-
From point , drop a perpendicular onto .
-
From point , drop a perpendicular onto .
From point , drop a perpendicular onto .
From point , drop a perpendicular onto .
Thus:
Also:
Let:
Step 2: Apply Pythagoras
Now, consider right triangles APC and BDQ.
In triangle APC:
In triangle BDQ:
Step 3: Eliminate
From equations (1) and (2):
Expanding:
So we have found x.
Step 4: Solve for
Now substitute into equation (1):
Step 5: Area of the trapezium
Finally, substitute back into the trapezium formula:
Now we have the formula to calculate the trapezium’s area using the four sides.
Source Code : SourceCodeLink
0 comments:
Post a Comment