第八周作业

最近刷了个矩形相交题:

for(int i=0;i<k;i++){
for(int j=0;j<4;j++)
a[j]=in.nextDouble();
for(int j=0;j<4;j++)
b[j]=in.nextDouble();
if(Math.max(a[0], a[2])<=Math.min(b[0], b[2])||Math.min(a[0], a[2])>=Math.max(b[0], b[2]))
n =1;
else
n=0;
if(Math.max(a[1], a[3])<=Math.min(b[1], b[3])||Math.min(a[1], a[3])>=Math.max(b[1], b[3]))
m = 1;
else
m=0;
if(n+m>0)
System.out.println("No");
else
System.out.println("Yes");
}

原文地址:https://www.cnblogs.com/qxg123/p/5430484.html