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

建议使用的浏览器:

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

1633:Orchard Trees

题目描述
An Orchardist has planted an orchard in a rectangle with trees uniformly spaced in both directions. Thus the trees form a rectangular grid and we can consider the trees to have integer coordinates. The origin of the coordinate system is at the bottom left of the following diagram:

Consider that we now overlay a series of triangles on to this grid. The vertices of the triangle can have any real coordinates in the range 0.0 to 100.0, thus trees can have coordinates in the range 1 to 99. Two possible triangles are shown.

Write a program that will determine how many trees are contained within a given triangle. For the purposes of this problem, you may assume that the trees are of point size, and that any tree (point) lying exactly on the border of a triangle is considered to be in the triangle.
输入解释
Input will consist of a series of lines. Each line will contain 6 real numbers in the range 0.00 to 100.00 representing the coordinates of a triangle. The entire file will be terminated by a line containing 6 zeroes (0 0 0 0 0 0).
输出解释
Output will consist of one line for each triangle, containing the number of trees for that triangle right justified in a field of width 4.
输入样例
1.5 1.5  1.5 6.8  6.8 1.5
10.7 6.9  8.5 1.5  14.5 1.5
0 0 0 0 0 0
输出样例
  15
  17
来自杭电HDUOJ的附加信息
Recommend linle

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 UVA

源链接: HDU-1633

最后修改于 2020-10-25T22:46:40+00:00 由爬虫自动更新

共提交 19

通过率 21.05%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)