KMP+扩展KMP
creator平
期望破茧成蝶时的飞翔,向往突破蝉蛹后的鸣叫。
展开
-
HDU - 1358 ——Period
For each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 ...原创 2018-04-30 09:33:55 · 122 阅读 · 0 评论 -
HDU - 3746 ——Cyclic Nacklace(最小添加使连成循环节)
CC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and thinking about how to...原创 2018-04-28 21:14:47 · 95 阅读 · 0 评论 -
FZU - 1901 ——Period II (所有循环节)
For each prefix with length P of a given string S,if S[i]=S[i+P] for i in [0..SIZE(S)-p-1], then the prefix is a “period” of S. We want to all the periodic prefixs. Input Input c...原创 2018-05-11 10:54:08 · 486 阅读 · 0 评论 -
HDU - 2609——How many (最多不重复循环串)
Give you n ( n < 10000) necklaces ,the length of necklace will not large than 100,tell me How many kinds of necklaces total have.(if two necklaces can equal by rotating ,we say the two necklaces a...原创 2018-05-11 08:33:34 · 502 阅读 · 0 评论 -
HDU - 3374——String Problem (最大最小表示法)
Give you a string with length N, you can generate N strings by left shifts. For example let consider the string “SKYLONG”, we can generate seven strings: String Rank SKYLONG 1 KYLONGS 2 YLONGSK 3...原创 2018-05-10 20:49:23 · 227 阅读 · 0 评论 -
HDU - 2328——Corporate Identity (多串找公共字串)
Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Internet Building Ma...原创 2018-05-09 18:50:40 · 273 阅读 · 0 评论 -
HDU - 2087——剪花布条 (假装是一道KMP)
一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input 输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种花样。花纹条和小饰条不会超过1000个字符长。如果遇见#字符,则...原创 2018-04-25 11:18:18 · 159 阅读 · 0 评论 -
HDU - 1686——Oulipo(串的出现次数)
The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tout s’...原创 2018-04-25 10:40:04 · 118 阅读 · 0 评论 -
HDU - 1711——Number Sequence (KMP入门题)
Given two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K ...原创 2018-04-25 09:10:34 · 160 阅读 · 0 评论 -
HDU - 3336——Count the string (前缀在字符串中的出现次数)
It is well known that AekdyCoin is good at string problems as well as number theory problems. When given a string s, we can write down all the non-empty prefixes of this string. For example: s: "abab...原创 2018-05-02 10:48:24 · 222 阅读 · 0 评论 -
POJ - 3080 ——Blue Jeans (多串字符找最长公共子字符)
The Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of thousands of contributors to map how the Earth was populated. ...原创 2018-04-30 20:34:19 · 112 阅读 · 0 评论 -
POJ - 2406——Power Strings (循环节恰好形成字符串的次数)
Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-...原创 2018-04-30 10:12:35 · 271 阅读 · 0 评论 -
FZU - 1926——填空 (KMP)
voj题目链接:https://cn.vjudge.net/contest/292206#problem/DFZU题目链接:http://acm.fzu.edu.cn/problem.php?pid=1926思路:用KMP,否则会超时,视乎用cin也会超时。KMP处理时注意模式串上'_'符号的处理。#include<string.h>#include<algori...原创 2019-04-03 21:11:31 · 156 阅读 · 0 评论