Facer’s string Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 2155 Accepted: 644 Description Minifacer was very happy these days because he has learned the algorithm of KMP recently. Yet his elder brother, Hugefacer, thought that Mini…
Description Facer is addicted to a game called "Tidy is learning to swim". But he finds it too easy. So he develops a new game called "Facer is learning to swim" which is more difficult and more interesting. In the new game, a robot na…
Given a string… Time Limit: 10000MS Memory Limit: 65536K Total Submissions: 1819 Accepted: 390 Case Time Limit: 2000MS Description Peter’s Boss is now very upset. He said that Peter’s vision of the orthogonal sum of two strings is not collinear t…
转自 stven_king的博客 这是一个求一个排序的下一个排列的函数,可以遍历全排列,要包含头文件<algorithm>下面是以前的笔记 (1) int 类型的next_permutation int main(){ int a[3];a[0]=1;a[1]=2;a[2]=3; do {cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;} while…
这是一个求一个排序的下一个排列的函数,可以遍历全排列,要包含头文件<algorithm>下面是以前的笔记 与之完全相反的函数还有prev_permutation (1) int 类型的next_permutation int main(){ int a[3];a[0]=1;a[1]=2;a[2]=3; do{cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<…
题目连接 http://poj.org/problem?id=2887 Big String Description You are given a string and supposed to do some string manipulations. Input The first line of the input contains the initial string. You can assume that it is non-empty and its length does not…
题目:http://poj.org/problem?id=3096 题意:给定一个字符串S,从中找出所有有两个字符组成的子串,每当组成子串的字符之间隔着n字符时,如果没有相同的子串出现,则输出 "S is surprising." , 反之,则输出 "S is NOT surprising." . 例如 AABA 把它分成两个字符为一个整体的,1..相邻两个字符 AA,AB,BA 没有相同的; 2.隔一个字符的 AB AA 没有相同; 3.隔…
题目:http://poj.org/problem?id=2887 Big String Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 6527 Accepted: 1563 Description You are given a string and supposed to do some string manipulations. Input The first line of the input…
Big String Time Limit: 1000MS Memory Limit: 131072K Description You are given a string and supposed to do some string manipulations. Input The first line of the input contains the initial string. You can assume that it is non-empty and its length doe…
String Matching Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 4074 Accepted: 2077 Description It's easy to tell if two words are identical - just check the letters. But how do you tell if two words are almost identical? And how close…
Shuffle'm Up Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 14471 Accepted: 6633 Description A common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of po…
String reduction Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1360 Accepted: 447 Description There is a string of characters 'a' and 'b' with the length of no more than 255 characters. You can perform the substring reduction on the…
题目大意,给出一个字符串s,求最大的k,使得s能表示成a^k的形式,如 abab 可以表示成(ab)^2: 方法:首先 先求kmp算法求出next数组:如果 len mod (len-next[len])==0 ,答案就是 len /(len-next[len]),否则答案是1:证明如下: 如果s能表示成 a^k的形式且k>1,k尽可能大,即s可以表示成aaaaaa(k个a):那么next[len]就等于k-1个a的长度:aaaaaaa aaaaaaa那么 (len-next[len])a的长…
Training little cats Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 9613 Accepted: 2296 Description Facer's pet cat just gave birth to a brood of little cats. Having considered the health of those lovely cats, Facer decides to make th…