![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
西杭
温水煮了将军梦
展开
-
数据结构实验之串三:KMP应用
题目链接 #include #include #include using namespace std; const int maxn=100000000+1000; int next[maxn]; int a[maxn], b[maxn]; void getnext(int len)///寻找每个位置的最大公共子缀的长度 { int i=0,j=-1; next[0]=-1; w原创 2016-08-03 20:52:32 · 759 阅读 · 0 评论 -
Message Flood
题目链接 这是我二月份交的代码,如今过去快半年了,但现在的水平也就堪刚看懂。不得不说,当时的确不是自己写的。 用的STL中的容器,先给所有名字全部转换大小写,然后进容器,在排序。最后二分查找,完成的题目。 #include #include #include #include #include #include using namespace std; int main() {原创 2016-08-04 14:29:34 · 572 阅读 · 0 评论 -
数据结构实验之串一:KMP简单应用
题目链接 #include #include #include using namespace std; int next[1000000]; void getnext(string a, string b)///寻找每个位置的最大公共子缀的长度 { int i=0,j=-1; next[0]=-1; int len=b.size(); while(i<len) { if(j原创 2016-08-03 20:07:06 · 627 阅读 · 0 评论 -
使用库函数判断是否子串
在c++中判断是否子串使用find类函数 具体代码如下: #include #include using namespace std; int main() { string Str1,Str2; int n; while(cin>>Str1>>Str2) { if((n=Str1.find(Str2,0))!=string::npos) cout<<n+1原创 2016-10-20 11:54:50 · 657 阅读 · 0 评论 -
SDUT离散题目4
离散题目4 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 题目给出两个非空整数集,请写出程序求两个集合的交集。 Input 多组输入,每组输入包括两行,第一行为集合A的元素,第二行为集合B的元素。具体参考示例输入。 每个集合元素个数不大于3000,每原创 2017-05-26 21:33:57 · 499 阅读 · 0 评论