摘要: C++中的stack是一个容器,一个先进后出的数据结构。 需要头文件:<stack> 构造:(这段看别人写的挺好,抄的) template <class T, class Container = deque<T> > class stack; 如上,这对尖括号中有两个参数,第一个是T,表示栈中存放的 阅读全文
posted @ 2020-08-05 16:54 不敢说的梦 阅读(275) 评论(0) 推荐(0)
摘要: 题目链接:POJ 3461 Describe: The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the 阅读全文
posted @ 2020-08-05 14:29 不敢说的梦 阅读(179) 评论(0) 推荐(0)
摘要: 首先推荐一下B站上一个阿三哥讲的KMP,通俗易懂,深入浅出(就是英语口语有些别扭) 传送门:汪都能听懂的KMP字符串匹配算法【双语字幕】 (时间有限,有机会把配图补上) 匹配原理: kmp算法是一种模式匹配算法,时间复杂度为O(m+n)。 kmp最大的特点是,当在某个字符匹配不成功时,不需要从头开始 阅读全文
posted @ 2020-08-05 12:37 不敢说的梦 阅读(700) 评论(0) 推荐(0)
摘要: substr()为string类的一个成员函数: str.substr(begin,length) 表示切割字符串str,从下标begin处开始,长度为length来切片 示例代码: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstr 阅读全文
posted @ 2020-08-05 10:57 不敢说的梦 阅读(3059) 评论(0) 推荐(0)
摘要: 题目链接:POJ 3080 Describe: The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from h 阅读全文
posted @ 2020-08-05 10:53 不敢说的梦 阅读(122) 评论(0) 推荐(0)
摘要: 字符串拷贝函数: 1、char *strcpy(char *dest,const char *src) 将src中的数据拷贝到dest中,并返回dest的地址 2、如果dest长度够长,则一部分数据会被覆盖,多余的保留 3、dest应该开大一点,防止复制时溢出 1 #include <iostrea 阅读全文
posted @ 2020-08-05 08:35 不敢说的梦 阅读(460) 评论(0) 推荐(0)
摘要: 字符串比较函数,按字典序比较: strcmp(s1,s2) 若s1大于s2,则返回正数,若s1小于s2,则返回负数,若相等,则返回零。 1 #include <iostream> 2 #include <cstring> // 注意头文件 3 using namespace std; 4 int m 阅读全文
posted @ 2020-08-05 08:30 不敢说的梦 阅读(326) 评论(0) 推荐(0)
摘要: strstr()函数是一个可以用来模式匹配的函数,函数使用方法如下: strstr(s1,s2)表示,s2为子串,查看s1中是否存在s2,存在则返回首次出现的地址,否则返回NULL 1 #include <iostream> 2 #include <cstring> // 注意头文件 3 using 阅读全文
posted @ 2020-08-05 08:23 不敢说的梦 阅读(1104) 评论(0) 推荐(0)
摘要: 题目链接:POJ 1488 Describe: TEX is a typesetting language developed by Donald Knuth. It takes source text together with a few typesetting instructions and 阅读全文
posted @ 2020-08-05 08:07 不敢说的梦 阅读(84) 评论(0) 推荐(0)