叉乘的坐标表示: A(X1,Y1), B(X2, Y2), C(XC,YC), D(XD, YD);AB = (X2-X1, Y2-Y1);CD = (XD-XC, YD-YC); 向量AB,CD的叉乘为:AB*CD= (X2-X1)*(YD-YC)-(Y2-Y1)*(X2-X1);例如两条直线,ab,cd来判断是否相交则根据ans = (cd叉乘ca)*(cd叉乘bd)如果ans大于等于0则相交,否则不相交. 下面是判断代码: /* Name:nyoj-1016-德莱联盟 Copyright:…