题解 | #判断直线相交#
判断直线相交
https://www.nowcoder.com/practice/1efe2386491f4235b78a34cd1b5fb3d0
import java.util.*; public class CrossLine { public boolean checkCrossLine(double s1, double s2, double y1, double y2) { // write code here if(s1 == s2 && y1 != y2){ return false; }else if(s1 == -s2 && y1 != y2){ return false; }else return true; } }
本题需注意当斜率互为相反数时也算平行