home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume17
/
contest-prog
/
part02
/
prob17.txt
< prev
next >
Wrap
Text File
|
1989-02-06
|
936b
|
28 lines
Problem 17: Point inside triangle.
When is a point (s,t) inside a triangle with vertices (x1, y1),
(x2, y2), (x3, y3)?? For this problem, the input will contain 20
lines containing coordinate pairs:
three lines with coordinates of three vertices of first triangle
seven lines, each with coordinates of a point to be tested therein
three lines with coordinates of three vertices of second triangle
seven lines, each with coordinates of a point to be tested therein
For example, if the first five lines of input were
3 2
6 10
15 7
5 7
14 6
the corresponding output would be
5 7 is inside triangle 1
14 6 is outside triangle 1
Spacing of the output is not important, but you must have the words
"is", "inside" or "outside", and "triangle" in your output, just as
in the example.
The vertices of the triangle, and the test point, are guaranteed to
be integers.