triangles rectangles and quadrilaterals
All submissions for this problem are available.
A quadrilateral can be inscribed in a rectangle by connecting the extreme edges such that two opposite sides of the rectangle are parallel to x- axis and the other two to the y-axis. the points of quadrilateral are (Ax,Ay),(Bx,By),(Cx,Cy),(Dx,Dy). While inscribing atleast two points touch the rectangle ,if a two straight lines are projected perpendicular to sides of rectangle from each non touching point , the rectangle will be divided into small triangles,rectangles . Find the number of mini rectangles formed , sum of area of the triangles newly formed and the area of the quadrilateral.there are certain rules in the selection of coordinates of quadrilateral .
NOTE:if the area of the quadrilateral is not integer the output should be zero
rules for coordinates:
The first line of input file contains number T the number of test cases followed by test case number . then description of each test case follows by 4 lines follow each consisting of coordinates of quadrilateral
Gives the number of mini rectangles formed in a format of character string followed by sum of area of triangles and area of quadrilateral only if area of quadrilateral is integer value and follows the rule of coordinates else output is simply "0"
- 1 ≤ T ≤ 10
- 1 ≤ N ≤ 10000
Input: 1 1 1 1 1 -2 -2 -2 -2 1 Output: Zero 0 9
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.