poj 2002 Squares
给出n个点,问能组成多少个正方形?
题解:
先把每个点hash
然后枚举两点(即枚举正方形的一条边),然后通过三角形全等,可以推出正方形的另外两点,在hash表里查找这两点看是存在,存在则 Cnt +1。
最后 answer = Cnt/4 //因为同一正方形都统计了4次。
#include
#include
#in...
分类:
其他好文 时间:
2014-08-22 13:03:48
阅读次数:
229
Description
Suppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix with the rows ...
分类:
其他好文 时间:
2014-08-22 12:56:59
阅读次数:
196
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4613
数学统计...
分类:
其他好文 时间:
2014-08-20 12:35:02
阅读次数:
155
Problem DescriptionThere are a bunch of stones on the beach; Stone color is white or black. Little Sheep has a magic brush, she can change the color o...
分类:
其他好文 时间:
2014-08-20 12:11:22
阅读次数:
209
列表推导与生成器表达式当我们创建了一个列表的时候,就创建了一个可以迭代的对象:>>> squares=[n*n for n in range(3)]>>> for i in squares: print i 014这种创建列表的操作很常见,称为列表推导。但是像列表这样的迭代器,比如str、file等...
分类:
编程语言 时间:
2014-08-17 01:05:01
阅读次数:
330
解题报告
题意:
矩形面积并。
思路:
扫描线+线段树
#include
#include
#include
#include
using namespace std;
struct Seg
{
int lx,rx,h,v;
friend bool operator < (Seg a,Seg b)
{
return a.h<b.h;
...
分类:
其他好文 时间:
2014-08-16 21:10:01
阅读次数:
241
Description
RPG battles
In many typical RPG games, you battle with bad guys, creatures, monsters or ghosts etc. all the time. After each battle, you may get magic potions th...
分类:
其他好文 时间:
2014-08-16 13:51:30
阅读次数:
245
Description
Optimal Symmetric Paths
You have a grid of n rows and
n columns. Each of the unit squares contains a non-zero digit. You walk from the top-left square to the b...
分类:
其他好文 时间:
2014-08-16 12:36:50
阅读次数:
332
题意描述:有一堆平面散点集,任取四个点,求能组成正方形的不同组合方式有多少。相同的四个点,不同顺序构成的正方形视为同一正方形。思路变迁:1、最简单的方法,直接暴力搜索,即依次取四个顶点,根据其坐标判断是否能组成正方形。组成正方形的条件是四个顶点可组成的六条边里面,有四条相等,剩下两条相等。当然由于其...
分类:
其他好文 时间:
2014-08-14 13:27:28
阅读次数:
357
Problem Description
FSF has programmed a game.
In this game, players need to divide a rectangle into several same squares.
The length and width of rectangles are integer, and of course the side len...
分类:
其他好文 时间:
2014-08-12 22:06:04
阅读次数:
248