Problem LinkDifficultyMEDIUM PrerequisitesCheck if a point lies inside a triangle Quick ExplinationFind areas of the three triangles formed by the given points and the origin and check if their sum matches the area of outer triangle. ExplinationTo check if the origin lies inside the triangle formed by the given coordinates, we need to find the area of the traingles formed by the three triangles i.e. the triangles formed by any two of the given triangles and the origin and check if the sum of these three areas equals the area of triangle formed by the given three coordinates.You can refer to Check whether a given point lies inside a triangle or not. There is only a single corner condition in the problem when all the three coordinates are on the origin. In this case although the three points do not form a triangle but according to the problem statement the answer for this condition will be YES. Given below is the solution to the problem in C++
asked 09 Nov '16, 18:37
