设为首页 加入收藏

TOP

SDUTOJ 2476Period
2015-07-20 17:25:46 来源: 作者: 【 】 浏览:2
Tags:SDUTOJ 2476Period
\
#include
  
   
#include
   
     #include
    
      #define N 1000010 using namespace std; char s[N]; int next[N]; void getnext(char s[]) { int j=-1,i=0,len; next[0]=-1; len=strlen(s); while(i<=len) { if(j==-1||s[i]==s[j]) { ++i; ++j; next[i]=j; } else j=next[j]; } } int main() { int j=1,i,n; while(cin>>n) { if(n==0) { break; } else cin>>s; getnext(s); cout<<"Test case #"<
     
      
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇HDU 3861 The King’s Problem(.. 下一篇poj2481 cows(线段树单点更新)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·TCP/UDP协议_百度百科 (2025-12-26 12:20:11)
·什么是TCP和UDP协议 (2025-12-26 12:20:09)
·TCP和UDP详解 (非常 (2025-12-26 12:20:06)
·Python 教程 - W3Sch (2025-12-26 12:00:51)
·Python基础教程,Pyt (2025-12-26 12:00:48)