![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
哈希
文章平均质量分 79
炎灸纹武
这个作者很懒,什么都没留下…
展开
-
简单的一个哈希查找函数
代码如下:#include #include #include #include #define m 100000 typedef long long LL; int h[1000020],p[1000020]; LL a[1000020]; int Search( LL key ) { int x=key%m; int next = h[x]; while(next)原创 2015-07-29 14:51:50 · 520 阅读 · 0 评论 -
poj 3349 Snowflake Snow Snowflakes
题目链接:http://poj.org/problem?id=3349 题 意:给你几组输入(六个数代表雪花的六个角),判断是否有相同的雪花。 思 路:使用哈希查找的方法将数据存入数组,若储存时有冲突发生,则已找到相同的雪花,后面的数据就都不需要处理。 注 :存储时,我使用的是数组的存储方式,并且将数组循环处理了。原创 2015-07-21 09:51:42 · 297 阅读 · 0 评论 -
HDU 1029 Ignatius and the Princess IV
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1029 题 意:找出一组n个数中出现次数大于等于(n+1)/2的数。 思 路: 一:map计算的方法。 代码如下:#include using namespace std; #include #include #include原创 2015-08-18 16:31:15 · 399 阅读 · 0 评论