解题报告 id=3096">题目传送门 题意: 给一个字符串,要求.对于这个字符串空隔为k取字符对(k=0,1,2,3,4...)要求在同样的空隔取对过程汇总.整个字符串中没有一个同样字符对如: ZGBZ: 间隔为0的字符对有: ZG.GB.BZ,三个均不同样 间隔为1的字符对有: ZG. GZ,均不同样 间隔为2的字符对有: ZZ 仅有一个,不必比較. 这样的字符串定义为"surprising". 之后依照格式输出. 思路: map暴力. #include <i…
题目:http://poj.org/problem?id=3096 题意:给定一个字符串S,从中找出所有有两个字符组成的子串,每当组成子串的字符之间隔着n字符时,如果没有相同的子串出现,则输出 "S is surprising." , 反之,则输出 "S is NOT surprising." . 例如 AABA 把它分成两个字符为一个整体的,1..相邻两个字符 AA,AB,BA 没有相同的;    2.隔一个字符的 AB AA 没有相同;          3.隔…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5783   Accepted: 3792 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
连续重复子串问题 poj 2406 Power Strings http://poj.org/problem?id=2406 问一个串能否写成a^n次方这种形式. 虽然这题用kmp做比较合适,但是我们还是用后缀数组做一做,巩固后缀数组的能力. 对于一个串,如果能写出a^n这种形式,我们可以暴力枚举循环节长度L,那么后缀suffix(1)和suffix(1 + L)的LCP应该就是 lenstr - L.如果能满足,那就是,不能,就不是. 这题的话da算法还是超时,等我学了DC3再写上来. 其实这…
题目传送门 /* 题意:一个串有字串重复n次产生,求最大的n KMP:nex[]的性质应用,感觉对nex加深了理解 */ /************************************************ * Author :Running_Time * Created Time :2015-8-10 10:51:54 * File Name :POJ_2406.cpp ************************************************/ #incl…
如何在const成员数中访问stl::map呢?例如如下代码: string ConfigFileManager::MapQueryItem(const string& name) const { if (_map_name_value.find(name) != _map_name_value.end()) { return _map_name_value[name]; } return ""; } 上面的代码会报错:error C2678: 二进制“[”: 没有找到接受“c…
2014多校7最水的题   Magical Forest Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 253    Accepted Submission(s): 120 Problem Description    There is a forest can be seen as N * M…
13.2 Compare and contrast a hash table and an STL map. How is a hash table implemented? If the number of inputs is small, which data structure options can be used instead of a hash table? 这道题让我们比较哈希表和STL中的map数据结构,在遇到这道题之前,我一直以为map就是c++中的哈希表呢,原来是不同的啊-…
转载请注明出处:http://blog.csdn.net/mxway/article/details/21321541 在搜索引擎在通常会对关键字出现的次数进行统计,这篇文章分析下使用C++ STL中的map进行统计,及使用字典树进行统计在运行速度,空间及适用场合进行分析.首先随机生成100万个3-6长度的字符串.为了简化问题,字符串中仅由小写字母组成.另外随机生成10万个长度3-8的字符串用于测试map和字典树在查询方面的效率. 下面是使用map和字典树实现的C++代码: STL map实现统…
ITS_NOTICE_MAP::reverse_iterator it = noticeMap.rbegin(); for ( ; it != noticeMap.rend(); ++it ) { Item_Info* nInfo = it->second; } STL map 函数作用iterator lower_bound( const key_type &key ): 返回一个迭代器,指向键值>= key的第一个元素.iterator upper_bound( const key…