随笔分类 -  字符串-字符串Hash

双hash/单hash/自然溢出
摘要:RK法:https://www.cnblogs.com/16crow/p/6879988.html #include<cstdio> #include<string> #include<cstdlib> #include<cmath> #include<iostream> #include<cstr 阅读全文
posted @ 2018-08-09 11:26 Roni_i 阅读(151) 评论(0) 推荐(0) 编辑
摘要:算法分析:预处理时间Θ(m),即求h,p,t的时间为,匹配时间在最坏情况下为Θ((n-m-1)m),因为可能出现每次都是可能命中点的情况。如T=a^n,P=a^m,此种情况下验证时间为Θ((n-m-1)m)。当然实际中,可能的命中点一般很少。假设有c个,则算法的期望匹配时间为O(n-m+1 +cm) 阅读全文
posted @ 2018-08-09 10:42 Roni_i 阅读(476) 评论(0) 推荐(0) 编辑
摘要:问题描述: Rabin-Karp的预处理时间是O(m),匹配时间O( ( n - m + 1 ) m )既然与朴素算法的匹配时间一样,而且还多了一些预处理时间,那为什么我们还要学习这个算法呢?虽然Rain-Karp在最坏的情况下与朴素匹配一样,但是实际应用中往往比朴素算法快很多。而且该算法的期望匹配 阅读全文
posted @ 2018-08-09 10:32 Roni_i 阅读(646) 评论(0) 推荐(0) 编辑
摘要:A sequence a1,a2,…,an is called good if, for each element ai, there exists an element aj (i≠j) such that ai+aj is a power of two (that is, 2d for some 阅读全文
posted @ 2018-07-21 21:40 Roni_i 阅读(249) 评论(0) 推荐(0) 编辑
摘要:变形课 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Total Submission(s): 29518 Accepted Submission(s): 10683 Problem 阅读全文
posted @ 2018-06-19 21:53 Roni_i 阅读(284) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/84/B 来源:牛客网 include using namespace std; const int N = 1000005; const int mod = 1e5; int n; int a[N]; int cnt[ 阅读全文
posted @ 2018-04-28 01:15 Roni_i 阅读(271) 评论(0) 推荐(0) 编辑
摘要:Description 输入一些仅由小写字母组成的单词。你的任务是统计有多少个单词是“酷”的,即每种字母出现的次数都不同。比如ada是酷的,因为a出现2次,d出现1次,而1和2不同。再比如,banana也是酷的,因为a出现3次,n出现2次,b出现1次。但是,bbacccd不是酷的,因为a和d出现的次 阅读全文
posted @ 2018-04-04 16:13 Roni_i 阅读(276) 评论(0) 推荐(0) 编辑
摘要:C. Shockers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output C. Shockers time limit per t 阅读全文
posted @ 2017-12-27 15:27 Roni_i 阅读(427) 评论(0) 推荐(0) 编辑
摘要:A. Generous Kefa time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Kefa found n ba 阅读全文
posted @ 2017-12-08 15:04 Roni_i 阅读(146) 评论(0) 推荐(0) 编辑
摘要:C. Registration system time limit per test 5 seconds memory limit per test 64 megabytes input standard input output standard output A new e-mail servi 阅读全文
posted @ 2017-12-02 18:03 Roni_i 阅读(246) 评论(0) 推荐(0) 编辑
摘要:1095 Anigram单词 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注 1095 Anigram单词 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 1095 Anigram单词 基准时间限制:1 秒 空间限制 阅读全文
posted @ 2017-11-04 09:48 Roni_i 阅读(225) 评论(0) 推荐(0) 编辑
摘要:1182 完美字符串 题目来源: Facebook Hacker Cup选拔 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 收藏 关注 1182 完美字符串 题目来源: Facebook Hacker Cup选拔 基准时间限制:1 秒 空间限制:131072 KB 阅读全文
posted @ 2017-10-31 20:29 Roni_i 阅读(207) 评论(0) 推荐(0) 编辑
摘要:B. Divisiblity of Differences time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output B. Divisibl 阅读全文
posted @ 2017-10-17 00:01 Roni_i 阅读(374) 评论(0) 推荐(0) 编辑
摘要:A. Search for Pretty Integers 【题目链接】:http://codeforces.com/contest/872/problem/A time limit per test 1 second memory limit per test 256 megabytes inpu 阅读全文
posted @ 2017-10-16 00:23 Roni_i 阅读(303) 评论(0) 推荐(0) 编辑
摘要:前m大的数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19800 Accepted Submission(s): 6781 Problem 阅读全文
posted @ 2017-10-05 14:47 Roni_i 阅读(252) 评论(0) 推荐(0) 编辑
摘要:输入一行文本,输出最长近似回文词连续子串。所谓近似回文词是指满足以下条件的字符串: 1. S以字母开头,字母结尾 2. a(S)和b(S)最多有2k个位置不同,其中a(S)是S删除所有非字母字符并且把所有字母转化成小写之后得到的串,b(S)是a(S)的逆序串。 比如当k=1时,Race cat是一个 阅读全文
posted @ 2017-08-18 01:25 Roni_i 阅读(238) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示