Codeforces 427 D. Match & Catch】的更多相关文章

后缀数组.... 在两个串中唯一出现的最小公共子串 D. Match & Catch time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Police headquarter is monitoring signal on different frequency levels. They have got two suspiciou…
[题目链接] http://codeforces.com/problemset/problem/427/D [题目大意] 给出一个两个字符串,求出最短且在两个字符串中唯一的公共子串. [题解] 以原字符串的两倍建立自动机,按字典序在parent树上搜索, 得到的第一个长度为n的字符串就是答案. [代码] #include <cstdio> #include <cstring> #include <algorithm> #include <vector> us…
D. Match & Catch 能够用各种方法做.字符串hash.后缀数组,dp.拓展kmp,字典树.. . 字符串hash(模板) http://blog.csdn.net/gdujian0119/article/details/6777239 BKDR Hash Function : // BKDR Hash Function unsigned int BKDRHash(char *str) { unsigned int seed = 131; // 31 131 1313 13131 1…
题目来源:CF 427D Match & Catch 题意:给出2个字符串 求最短的连续的公共字符串 而且该字符串在原串中仅仅出现一次 思路:把2个字符串合并起来求height 后缀数组height的应用 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 100010; char s[maxn]; int sa[maxn]…
#427 Div2 D 题意 给出一个字符串,求它的子串中为 \(k-palindrome\) 的个数. \(1-palindrome\) 要求是一个回文串. \(k-palindrome (k > 1)\)满足以下条件: 是一个回文串 它的左右两边是一个不为空的 \((k - 1)-palindromes\) . 分析 求字符串回文子串个数是一个很经典的题目了,这题变化也不大. \(dp[i]\) 表示以当前字符结尾的长度为 \(i\) 的字符串 \(k\) 的最大值. 注意 \(2-pali…
F. Roads in the Kingdom time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Kingdom K., there are n towns numbered with integers from 1 to n. The towns are connected by n bi-directional…
java爬虫遇到个页面加密的东西,找了些资料学习学习 做了个java运行js的工具类,希望对大家有用,其中用到client(获取js)可以自行换成自己的client.主要是用了 Rhino就是JavaScript引擎,它的目的就是实现Java与JavaScript的互操作性.rhino-1.7R1.jar Envjs一个纯js方式在无浏览器环境下模拟浏览器的行为.envjs-1.2.js 一般网站js中都会用到jauery,所以还用了jauery.js import java.io.Buffer…
1. 内置zip压缩与解压 Zip是最为常用的文件压缩格式之一,也被几乎所有操作系统支持.在之前,使用程序去进行zip压缩和解压要靠第三方组件去支持,这一点在.NET4.5中已有所改观,Zip压缩和解压功能已经内置于框架本身.这个功能使用起来很简单,三步即可: 第一步:在当前工程中添加两个Reference: System.IO.Compression.FileSystem System.IO.Compression 第二步:引用命名空间: using System.IO.Compression…
  JsRender是一款基于jQuery的JavaScript模版引擎 特点: · 简单直观 · 功能强大 · 可扩展的 · 快如闪电 jsrender使用比较简单,本文简单结束一些常用的 使用过程: 1. 下载并导入相关js库(最后提供三个js源文件的源码copy,可直接使用) <script src="jsrender/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"…
今天需要做图片上传与生成缩略图的功能,把代码进行记录如下: html 视图              ($pic_action_url = $this->createAbsoluteUrl('home/upload');) <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <title></title> <script type="tex…