n the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. Here, we are only concerned with if various pairs of straws are connected by a path of touching straws. You will be given a list of the endpoints for some straws (as if they were dumped on a large piece of graph paper) and then will be asked if various pairs of straws are connected. Note that touching is connecting, but also two straws can be connected indirectly via other connected straws.
输入
A problem consists of multiple lines of input. The first line will be an integer n (1 < n < 13) giving the number of straws on the table. Each of the next n lines contain 4 positive integers, x1 , y1 , x2 and y2 , giving the coordinates, (x1 ; y1 ); (x2 ; y2 ) of the endpoints of a single straw. All coordinates will be less than 100. (Note that the straws will be of varying lengt
SWUST OJ 之 0680 Jack Straws
最新推荐文章于 2020-01-26 17:45:47 发布
该博客讨论了一种名为Jack Straws的游戏,其中涉及判断线段是否通过接触路径相互连接。输入包括线段的坐标和要检查的线段对,输出是线段是否相连。博主分析了使用动态规划解决问题的方法,通过计算线段斜率差值和位置关系来确定相交情况,并构建二维数组记录线段连接状态。
摘要由CSDN通过智能技术生成