Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

我也来说几句我的想法

Posted by acleast at 2010-04-19 20:29:48 on Problem 1410
注意输入,前面有人说了
1.排除线段在矩形上下左右四周的情况,F
2.排除线段在矩形内部的情况,T
3.调用两次检查两个点是否分在直线两侧,即将两个点的坐标代入直线方程
bool f(int a,int b,int c,int d) //(a,b) (c,d)两点
{
	int p=(y2-y1)*(a-x1)-(b-y1)*(x2-x1);
	int q=(y2-y1)*(c-x1)-(d-y1)*(x2-x1);
	if(p*q>0) return false; //相交
	else return true;  //不相交
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator