题目链接
题意:
若一个字符串是半回文串,则满足第一位和最后一位相等, 第三位和倒数第三位相等,如此类推。
给定一个字符串s,输出s的所有子串中的半回文串字典序第k大的 字符串。
good[i][j] 表示 s(i,j) 是半回文串。
把这些回文串插到字典树里 在字典树上找第k个叶子节点。
插入时:插入以i点开头的所有半回文串。
#include
#include ...
分类:
其他好文 时间:
2015-07-17 00:34:29
阅读次数:
169
1. 使用 Map比使用Set可以省去查找(遍历)2. 逻辑上 查找一个word, 是遍历word的每一个字符。 不是遍历 tree.拿到一个字符时,直接使用map.containsKey(x);过程: 遍历 --> word : "cbd" (非无限,到word末尾自然结束循环遍历) 当前节点.....
分类:
其他好文 时间:
2015-07-16 21:31:35
阅读次数:
102
Language of FatMouse
Time Limit: 10 Seconds
Memory Limit: 32768 KB
We all know that FatMouse doesn't speak English. But now he has to beprepared since our nation will join WTO soon. Than...
分类:
其他好文 时间:
2015-07-16 14:12:48
阅读次数:
98
What Are You Talking About
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K (Java/Others)
Total Submission(s): 16042 Accepted Submission(s): 5198
Problem Descriptio...
分类:
其他好文 时间:
2015-07-16 14:11:23
阅读次数:
109
统计难题
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)
Total Submission(s): 22291 Accepted Submission(s): 9424
Problem Description
Ignatius最近遇到一个难题,老师...
分类:
其他好文 时间:
2015-07-16 14:11:23
阅读次数:
113
Hat’s Words
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9574 Accepted Submission(s): 3421
Problem Description
A hat’s word is a ...
分类:
其他好文 时间:
2015-07-16 14:06:02
阅读次数:
95
Keywords Search
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 42877 Accepted Submission(s): 13502
Problem Description
In the moder...
分类:
其他好文 时间:
2015-07-16 14:04:04
阅读次数:
129
题意:实现trie树的3个功能,只含小写字母的串。思路:老实做即可! 1 class TrieNode { 2 public: 3 TrieNode* chd[26]; 4 bool flag; 5 // Initialize your data structure her...
分类:
其他好文 时间:
2015-07-16 00:48:37
阅读次数:
150
搞了一晚上AC自动机,发现需要先学trie和kmp……都不会啊。。于是又去现学KMP和trie。。终于基本看懂AC自动机了。#include using namespace std;struct node{ int next[26];//每一个节点可以扩展到的字母 int fail;//...
分类:
其他好文 时间:
2015-07-15 22:20:46
阅读次数:
109
题目链接一A,开森~ac代码: 1 class TrieNode { 2 // Initialize your data structure here. 3 char content; 4 boolean isWord; 5 int count; 6 Link...
分类:
其他好文 时间:
2015-07-14 21:59:57
阅读次数:
150