摘要: 原题链接:分析:求最小周期的应用。 1 #include 2 #include 3 #include 4 #include 5 #define maxn 1005 6 using namespace std; 7 char s[maxn]; 8 int next[maxn],len; 9 void get_next()10 {11 int i=0,j=-1;len=strlen(s);12 next[0]=-1;13 while(i<len)14 {15 if(j==-1||s[i]==s[j]){16 i++,j++;1... 阅读全文
posted @ 2013-09-08 19:21 EtheGreat 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://acm.uestc.edu.cn/problem.php?pid=1655分析:注意可能会反向。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #define maxn 1005 7 #define inf 0x7fffffff 8 using namespace std; 9 int l[maxn],r[maxn];10 int dis1[maxn];//clockwise11 int dis2[maxn];//ante-clockwise12 int ans[maxn];13 int main()1 阅读全文
posted @ 2013-09-08 18:40 EtheGreat 阅读(126) 评论(0) 推荐(0) 编辑