设为首页 加入收藏

TOP

SDUTOJ 2476Period
2015-07-20 17:25:46 来源: 作者: 【 】 浏览:3
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(线段树单点更新)

评论

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

·微服务 Spring Boot (2025-12-26 18:20:10)
·如何调整 Redis 内存 (2025-12-26 18:20:07)
·MySQL 数据类型:从 (2025-12-26 18:20:03)
·Linux Shell脚本教程 (2025-12-26 17:51:10)
·Qt教程,Qt5编程入门 (2025-12-26 17:51:07)