Simpsons' Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2798    Accepted Submission(s): 1055 Problem Description Homer: Marge, I just figured out a way to discover some of the…
Simpsons' Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4597    Accepted Submission(s): 1671 Problem Description Homer: Marge, I just figured out a way to discover some of the…
题目链接:http://acm.acmcoder.com/showproblem.php?pid=2594 题意:求最长的串 同一时候是s1的前缀又是s2的后缀.输出子串和长度. 思路:kmp 代码: #include <vector> #include <string> #include <algorithm> #include <iostream> #include <stdio.h> #include <string.h> us…
Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15015    Accepted Submission(s): 5151 Problem Description Homer: Marge, I just figured out a way to discover some of the…
题目链接:https://vjudge.net/problem/HDU-2594 Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10647    Accepted Submission(s): 3722 Problem Description Homer: Marge, I just f…
Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1746 Accepted Submission(s): 637 Problem Description Homer: Marge, I just figured out a way to discover some of the talents…
Simpsons’ Hidden Talents Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6888    Accepted Submission(s): 2461 Problem Description Homer: Marge, I just figured out a way to discover some of the…
求next数组,(一般有两种,求循环节用的见代码)求出循环节的长度. #include <cstdio> #define N 100005 int n,next[N]; char s[N]; int main(){ scanf("%d",&n); while(n--){ scanf("%s",s); int i=0,k=-1; next[0]=k; while(s[i]){ if(k==-1||s[i]==s[k]) { i++; k++; ne…
Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had.Marge: Yeah, what is it?Homer: Take me for example. I want to find out if I have a talent in politics, OK?Marge: OK.Homer: So I take some politician’s name…
Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had. Marge: Yeah, what is it? Homer: Take me for example. I want to find out if I have a talent in politics, OK? Marge: OK. Homer: So I take some politician’s…