当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2954:Triangle

题目描述

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 x1y1 = 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.

输入样例
0 0 1 0 0 1
0 0 5 0 0 5
0 0 0 0 0 0
输出样例
0
6

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Stanford Local 2004

源链接: POJ-2954

最后修改于 2020-10-29T06:48:28+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536