poj2752 Seek the Name, Seek the Fame 2012-1-11
2016-03-02 20:46
225 查看
http://162.105.81.212/JudgeOnline/problem?id=2752
Program Stone; var i,j,k,n:longint; b,a:array[1..400000]of longint; s:ansistring; Begin assign(input,'input.in');reset(input); while not(eof) do begin readln(s); j:=0;b[1]:=0; for i:=2 to length(s) do begin while (j>0)and(s[i]<>s[j+1]) do j:=b[j]; if s[i]=s[j+1] then inc(j); b[i]:=j; end; i:=length(S); k:=0; while i<>0 do begin inc(k); a[k]:=i; i:=b[i]; end; for i:=k downto 1 do write(a[i],' '); writeln; end; close(input); end.
相关文章推荐
- C++运算符重载详解
- HDU 1017 A Mathematical Curiosity(数学题目)
- 2016 qut第一次训练赛简单题
- 交换a、b值
- springmvc的一个小例子学习(一)
- poj1961 Period 2012-01-11
- 使用Node.js+Socket.IO搭建WebSocket实时应用【转载】
- iOS 后台运行实现
- overridePendingTransition
- Exynos4412 Uboot 编译工具 —— 交叉工具链 arm-linux-gcc 的安装
- 利用jQuery中hover()和cookie机制编写的小程序
- LeetCode 226. Invert Binary Tree
- poj2406 Power Strings 2012-01-11
- 自我简介与Github的注册和使用
- hdoj M斐波那契数列 4549&nyoj 又见斐波那契数列 1000 (矩阵快速幂&规律)
- 历届试题 数字游戏
- some frequently-used formula
- 项目记录25--unity-tolua框架 View02---BasePanel.lua
- string对象的比较
- 浅谈fls3的一个压缩问题