摘要: 翻译 字典树 和 map 都可以字典树265 MS63592 KB map 1906MS 36100 KBView Code /*scanf printf gets dont apply to stringcan only use cin or cout*/#pragma warning( disable: 4786 ) //防止stl里面的warning#include <stdio.h>#include <iostream>#include <string>#include <map>using namespace std; // cin / 阅读全文
posted @ 2013-03-12 16:53 April_Tsui 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 其实就是求出现的次数最多的数因为输入有30位 我也不明白为毛用map就可以的 而且为毛可以scanf("%I64", &level)明明int64最多18位 会溢出 但一到map就算level溢出了 只要数是一样的他照样行=-=如 9999999999999999999999999999999999999999999999 虽然溢出level为负数但map神奇地找到 而且可以++ =-=可能与map里面以红黑树储存有关吧 。。。。View Code #include <stdio.h>#include <string.h>#include & 阅读全文
posted @ 2013-03-12 14:34 April_Tsui 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 给一列数据list 再给查询字符串 求字符串在list中出现的次数对于每个数据 暴力枚举他的子串 注意同一个字符串出现的次数不要叠加如 list: abab ab Q: ab 则答案为2 不为3 故要记录子串处于哪个数据(pos)View Code #include <stdio.h>#include <stdlib.h>#include <string.h>const int MAXN = 50005;struct node{ int pos, cnt; node *next[26]; node() { cnt = 1; memset(ne... 阅读全文
posted @ 2013-03-12 13:27 April_Tsui 阅读(129) 评论(0) 推荐(0) 编辑