题意是在所给的两个字符串中找最长的公共前后缀,即第一个字符串前缀和第二个字符串后缀的最长相等串. 思路是将两个字符串拼接在一起,然后直接套用 kmp 算法即可. 要注意用 next 会报编译错误,改成 Next 才过……但 next 确实不是 c++ 关键字. 代码如下: #include <iostream> #include <cstring> #include <cstdio> using namespace std; +; ],b[N]; ]; void get
Oulipo Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 24592 Accepted Submission(s): 9516 Problem Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, wi
Power Strings Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 47748 Accepted: 19902 Description 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 = &quo
<span style="color:#FF0000;">第一步:把输入的数字转为字符串n.ToString() 第二步:求出字符串的长度即为正整数的位数 第三步:从后向前逆序输出</span> 附代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; //给一个正整数, //要求:一.求它是几位数,二.逆序打印出各位数字. namespa