http://acm.sdut.edu.cn:8080/vjudge/contest/view.action?cid=42#problem/D 改了N多次之后终于A了,一直在改判断正方形和矩形那,判断正方形时算出六条边再排序,若前四条边相等并且与后两条边满足勾股定理,说明是正方形, 判断矩形时,我先对结构体二级排序,这样四个点有确定的顺序,再用点积判断是否有三个角是直角,是的话就是矩形. #include<stdio.h> #include<string.h> #include&l…
B. Rectangle and Square 题目连接: http://codeforces.com/contest/135/problem/B Description Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise di…
bzoj1661[Usaco2006 Nov]Big Square 巨大正方形 题意: n*n的图中有一些J点,一些B点和一些空白点,问在空白点添加一个J点所能得到的有4个J点组成最大正方形面积.n≤100. 题解: 枚举两个点,然后根据这两个点组成的边尝试在4个上下两个方向组成四边形. 代码: #include <cstdio> #include <cstring> #include <algorithm> #include <queue> #define…
题目:http://codeforces.com/problemset/problem/135/B 题意:给8个点 判断能否用 4个点构成正方形,另外4个点构成 矩形. 输出 第一行是正方形 ,第二行是矩形. 我的思路:用了4个for循环 枚举四个点, 用向量判断,四个点构成 六条边,如果这六条边里, 有四条边 与他们垂直的边有两个,就说明是矩形,在这个基础上,有 2条边 与他们垂直的边有一个. 说明是正方形. #include<iostream> #include<cstdio>…
Given the coordinates of four points in 2D space, return whether the four points could construct a square. The coordinate (x,y) of a point is represented by an integer array with two integers. Example: Input: p1 = [0,0], p2 = [1,1], p3 = [1,0], p4 =…
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 0 Return 4. Credits:Special thanks to @Freezen for adding this pr…
霍夫变换 霍夫变换是1972年提出来的,最开始就是用来在图像中过检测直线,后来扩展能检测圆.曲线等. 直线的霍夫变换就是 把xy空间的直线 换成成 另一空间的点.就是直线和点的互换. 我们在初中数学中了解到,一条直线可以用如下的方程来表示:y=kx+b,k是直线的斜率,b是截距. 我们转换下变成:b=-kx+y.我们是不是也可以把(k,b)看作另外一个空间中的点?这就是k-b参数空间. 这样,我们就把一条x-y直线用一个(k,b)的点表示出来了. 我们看到,在x-y图像空间中的一个点,变成了k-…
HDOJ1518 Square Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11375    Accepted Submission(s): 3660 Problem Description Given a set of sticks of various lengths, is it possible to join them e…
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix: 1 0 1 0 0 1 0 1 1 1 1 1 0 0 1 0 Return 4. Credits:Special thanks to @Freezen for adding this pr…
Description Little Petya very much likes rectangles and especially squares. Recently he has received 8 points on the plane as a gift from his mother. The points are pairwise distinct. Petya decided to split them into two sets each containing 4 points…