摘要:
在几何问题中,运用向量的内积和外积进行计算是非常方便的。对于二维向量p1=(x1,y1)和p2=(x2,y2),我们定义内积p1·p2=x1*x2+y1*y2,外积p1×p2=x1*y2-y1*x2。 要判断点q是否在线段p1-p2上,只要先用外积跟据是否有(p1-q)×(p2-q)=0来判断点q是否在直线p1-p2上,再利用内积根据是否有(p1-q)·(p2-q)≤0来判断点q是否落在p1-p2之间。 要判断两条线段是否有交点,可以先求出两条线段所在直线的交点,再判断交点是否在两条线段上。(这里要注意考虑两条线段平行的情况,这种情况下不能直接求两条直线 阅读全文
posted @ 2014-02-28 21:52
~~Snail~~
阅读(753)
评论(0)
推荐(0)
摘要:
Jack StrawsTime Limit:1000MSMemory Limit:10000KTotal Submissions:2942Accepted:1331DescriptionIn 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 阅读全文
posted @ 2014-02-28 21:39
~~Snail~~
阅读(286)
评论(0)
推荐(0)

浙公网安备 33010602011771号