上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 50 下一页
摘要: Dominating Patterns UVALive - 4670 题意:给n个短串1个长串,问这个长串中出现次数最多的短串,并输出 学习了lrj不用指针的写法 需要注意的是模板串可能有重复,用map搞一下 1 #include <bits/stdc++.h> 2 using namespace 阅读全文
posted @ 2017-08-18 10:40 yijiull 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Crazy Search POJ - 1200 题意:求由nc个字母组成的长串中有多少长度为n的不同子串 将原串看成nc进制的数,分别求出长度为n的串的哈希值之后统计出不同的哈希值数即可。 1 #include <cstring> 2 #include <iostream> 3 #include < 阅读全文
posted @ 2017-08-18 10:36 yijiull 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Flying to the Mars HDU - 1800 题意:求最多有多少个数字相等,数可能很大,30位。 本来直接map就可以,练习一下哈希,先映射成数再用的map。。。 1 #include <cstring> 2 #include <iostream> 3 #include <cstdio 阅读全文
posted @ 2017-08-18 10:36 yijiull 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Matrix Matcher UVA - 11019 题意:给两个二维字符串,问小的在大的里面出现了多少次。 本来看到白书上说ac自动机,搜题解看到有个人用hash写的,就学习了下。。。orz 等下再去敲自动机。。。 1 #include <bits/stdc++.h> 2 using namesp 阅读全文
posted @ 2017-08-18 10:34 yijiull 阅读(191) 评论(0) 推荐(0) 编辑
摘要: Milk Patterns POJ - 3261 题意:问长度为n的串中至少出现k次的子串最长是多长。 二分长度,再判断是否有子串重复k次。 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algo 阅读全文
posted @ 2017-08-18 10:33 yijiull 阅读(187) 评论(0) 推荐(0) 编辑
摘要: String HDU - 4821 题意:求长串中存在多少个长度为M*L的子串(是由M个长度为L的子串构成的) 算是第一道哈希题了,看的别人的代码 先求出原串左边起到第i位的哈希值h[i],然后枚举起点,计算出前M段,然后利用滑动窗口右移,因此起点只需从1枚举到L即可 1 #include <bit 阅读全文
posted @ 2017-08-18 10:32 yijiull 阅读(248) 评论(0) 推荐(0) 编辑
摘要: Discrete Logging POJ - 2417 题意:给P,B,N,求最小的L使得 BL≡N (mod P),其中P是素数。 Baby Step Giant Step 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 阅读全文
posted @ 2017-08-17 23:39 yijiull 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Biorhythms POJ - 1006 题意: 求解一元线性同余方程组。 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 const int maxn=1010; 5 int b[maxn],m[maxn]; 6 阅读全文
posted @ 2017-08-17 20:15 yijiull 阅读(116) 评论(0) 推荐(0) 编辑
摘要: The Luckiest number POJ - 3696 题意:给一个数L,问至少几个8(如88,8888,88888)可以整数L。若不能,就输出-1. 参考的两位dalao的 http://blog.csdn.net/Danliwoo/article/details/48865127 http 阅读全文
posted @ 2017-08-17 17:30 yijiull 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Area of Mushroom HDU - 4946 题意: 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 #include <algorithm> 5 #include <cmath> 6 using names 阅读全文
posted @ 2017-08-17 12:29 yijiull 阅读(102) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 50 下一页