代码 <?php $a=[0,0]; $b=[0,1]; $c=[1,1]; $d=[1,0]; $ar=array($a,$b,$c,$d); $a1=[]; // 0 1 2 3 foreach ( $ar as $key => $value) { unset($ar[$key]); foreach ($ar as $k => $v) { $a1[]=gettest($value,$v); } } $a_unique=array_unique($a1); $max=max($a_un…
Description Given a rectangle and a circle in the coordinate system(two edges of the rectangle are parallel with the X-axis, and the other two are parallel with the Y-axis), you have to tell if their borders intersect. Note: we call them intersect ev…
题目链接 Intersection Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12040   Accepted: 3125 Description You are to write a program that has to decide whether a given line segment intersects a given rectangle. An example: line: start point:…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1221 Rectangle and Circle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3434    Accepted Submission(s): 904 Problem Description Given a rectangle…
http://poj.org/problem?id=1410 题目大意:给你一个线段和矩形的对角两点  如果相交就输出'T'  不想交就是'F' 注意: 1,给的矩形有可能不是左上 右下  所以要先判断的 2,线段在矩形的内部输出T 3,如果交点是矩形的顶点的话 是不相交的 情况有点多  刚开始考虑的太少   wa的我心疼 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.…
C. White Sheet There is a white sheet of paper lying on a rectangle table. The sheet is a rectangle with its sides parallel to the sides of the table. If you will take a look from above and assume that the bottom left corner of the table has coordina…
题目链接:https://vjudge.net/problem/POJ-1410 题意:判断线段和矩形是否相交. 思路:注意这里的相交包括线段在矩形内,因此先判断线段与矩形的边是否相交,再判断线段的两端点是否在矩形内(因为是矩形,即凸多边形,直接用叉积判断即可,如果是一般的多边形,需要用射线法判断.) AC code: #include<cstdio> #include<algorithm> #include<cmath> #include<cstdlib>…
#1040 : 矩形判断 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 给出平面上4条线段,判断这4条线段是否恰好围成一个面积大于0的矩形. 输入 输入第一行是一个整数T(1<=T<=100),代表测试数据的数量. 每组数据包含4行,每行包含4个整数x1, y1, x2, y2 (0 <= x1, y1, x2, y2 <= 100000):其中(x1, y1), (x2,y2)代表一条线段的两个端点. 输出 每组数据输出一行YES或者NO,表示输入的…
题目链接: G - Intersecting Rectangles Kattis - intersectingrectangles 题目大意:给你n个矩形,每一个矩形给你这个矩形的左下角的坐标和右上角的坐标,然后问你这些矩形会不会相交,如果存在相交的点,输出1,否则输出0. 具体思路:扫描线,我们首先对x进行排序,然后判断当前x直线对应的线段上是否有x已经覆盖,如果已经有就证明存在相交的情况.但是这样会存在多算的情况,所以我们对于每一个矩形的左端点打一个标记,然后右端点再打一个标记,当左端点的时…
这个题目要注意的是:给出的矩形坐标不一定是按照左上,右下这个顺序的 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define eps 1e-8 #define INF 1e9 using namespace std; const int maxn=100; typedef struct Point {…