
快速查找
文章平均质量分 71
Terry__J
这个作者很懒,什么都没留下…
展开
-
poj 2002 Squares
<br />题意:给出n个点,求这n个点能组成多少个不同正方形.<br />思路: 枚举+快查.(再次学习了快速查找)<br />代码:<br />#include <iostream> #include <algorithm> #include <cstdio> using namespace std; struct point { int x,y; }p[1001],tmp; int cmp(point a, point b) { if(a.x == b.x) retur原创 2011-05-02 12:10:00 · 511 阅读 · 0 评论 -
fdu Problem 2072 Count
思路:对数组非降序排序,并记录原始下标。利用二分查找,找到要查找的数后进行区间判断,如果在查询区间的话,count累加;不在的话,继续查找,仍是二分。 #include #include #include #include using namespace std; const int N = 100009; struct Arr { int val, it; }; Arr原创 2012-03-26 08:49:35 · 634 阅读 · 0 评论