The painted points
Easy
Execution time limit is 0.1 seconds
Runtime memory usage limit is 64 megabytes
Given the coordinates of the vertices of a triangle (which happen to be lattice points), you must count the number of lattice points that lie completely inside the triangle (points on the edges or vertices of the triangle do not count).
Input
Each line consists of six integers x[1]
, y[1]
, x[2]
, y[2]
, x[3]
, and y[3]
, where (x[1], y[1])
, (x[2], y[2])
, and (x[3], y[3])
are the coordinates of triangle vertices. All triangles are non-degenerate (have positive area) and -15000 ≤ x[1]
, y[1]
, x[2]
, y[2]
, x[3]
, y[3]
≤ 15000. The last line contains six zeros and should not be processed.
Output
For each input line print the number of internal lattice points in a single line.
Examples
Input #1
Answer #1
Submissions 1K
Acceptance rate 19%