We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- All Contests
- ProjectEuler+
- Project Euler #102: Triangle containment

# Project Euler #102: Triangle containment

# Project Euler #102: Triangle containment

_{This problem is a programming version of Problem 102 from projecteuler.net}

Three distinct points are plotted at random on a Cartesian plane, for which , such that a triangle is formed.

Consider the following two triangles:

It can be verified that triangle ABC contains the origin, whereas triangle XYZ does not.

You are given co-ordinates of N "random" triangles, find the number of triangles for which the interior contains the origin.

**Input Format**

First line contains an integer i.e. number of triangles, followed by lines each having 6 space separated integers representing a triangle.

**Constraints**

**Output Format**

Print 1 line, the number of triangles that contain origin.

**Sample Input**

```
2
-1 -2 1 -2 1 3
-2 -1 -2 1 -1 2
```

**Sample Output**

```
1
```