1227. Another intelligence

单点时限: 2.0 sec

内存限制: 256 MB

A lattice point is an ordered pair (x, y) where x and y are both integers. Given the coordinates of the vertices of a triangle (which happen to be lattice points), you are to count the number of lattice points which lie completely inside of the triangle (points on the edges or vertices of the triangle do not count).

输入格式

The input test file will contain multiple test cases. Each input test case consists of six integers x1, y1, x2, y2, x3, and y3, where (x1, y1), (x2, y2), and (x3, y3) are the coordinates of vertices of the triangle. All triangles in the input will be non-degenerate (will have positive area), and -15000 ≤ x1, y1, x2, y2, x3, y3 ≤ 15000. The end-of-file is marked by a test case with x1 = y1 = x2 = y2 = x3 = y3 = 0 and should not be processed.

输出格式

For each input case, the program should print the number of internal lattice points on a single line.

样例

Input
0 0 1 0 0 1
0 0 5 0 0 5
0 0 0 0 0 0
Output
0
6

9 人解决,16 人已尝试。

16 份提交通过,共有 50 份提交。

6.7 EMB 奖励。

创建: 17 年,5 月前.

修改: 7 年,2 月前.

最后提交: 2 年,8 月前.

来源: LSP

题目标签