poj 2406
来源:互联网 发布:淘宝达人 自媒体 认证 编辑:程序博客网 时间:2024/06/07 12:22
点击打开链接//求循环次数#include <iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;const int maxn=1e6+5;char T[maxn];int m;void Getnext(int next[]){ int i=0,j=next[0]=-1; m=strlen(T); while(i<m) { if(j==-1||T[i]==T[j]) { i++; j++; next[i]=j; } else j=next[j]; }}int main(){ while(scanf("%s",T)!=EOF) { if(T[0]=='.') break; int next[maxn]; Getnext(next); //得到next数组 int k=1; if(m%(m-next[m])==0) k=m/(m-next[m]); printf("%d\n",k); } return 0;}
阅读全文
0 0
- POJ 2406
- POJ 2406
- poj 2406
- POJ 2406
- poj 2406
- poj 2406
- poj 2406
- poj 2406
- poj 2406
- poj 2406
- 【POJ 2406 】
- POJ 2406
- poj 2406
- POJ 2406
- poj 2406
- POJ-2406
- POJ 2406
- poj--2406
- 1017. A除以B (20)
- leetcode99
- JAVA 基础知识 异常
- caffe运行过程
- 七周第三次课 2017.11.29 Linux网络相关、firewalld和netfilter、netfilter5表5链介绍、iptables语法
- poj 2406
- IDEA Maven导自建的jar包
- 时间编程综合应用 time ctime localtime asctime
- htmlunit
- centos下redis命令
- 将本地项目传输到github上
- Retrofit2 完全解析 探索与okhttp之间的关系
- java 数组越界
- 8.1(2)