TOYS
Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toys in, but John is rebellious and obeys his parents by simply throwing his toys into the box. All the toys get mixed up, and it is impossible for John to find his favorite toys.
John's parents came up with the following idea. They put cardboard partitions into the box. Even if John keeps throwing his toys into the box, at least toys that get thrown into different bins stay separated. The following diagram shows a top view of an example toy box.
题目:http://poj.org/problem?id=2318
Description
Calculate the number of toys that land in each bin of a partitioned toy box.Mom and dad have a problem - their child John never puts his toys away when he is finished playing with them. They gave John a rectangular box to put his toys in, but John is rebellious and obeys his parents by simply throwing his toys into the box. All the toys get mixed up, and it is impossible for John to find his favorite toys.
John's parents came up with the following idea. They put cardboard partitions into the box. Even if John keeps throwing his toys into the box, at least toys that get thrown into different bins stay separated. The following diagram shows a top view of an example toy box.

这是一篇关于ACM竞赛中计算几何题目的博客,详细介绍了POJ2318题目。文章讨论了如何利用点线关系判断矩形内的线段划分,并对输入的点进行计数。通过叉积判断点相对于线段的位置,确定点属于哪个区域,重点强调了处理边界情况和输出格式的注意事项。
最低0.47元/天 解锁文章
1844

被折叠的 条评论
为什么被折叠?



