#include<iostream>
#include<stdio.h>
#include<string.h>
#define mx 1000005
using namespace std;
char arr[mx];
int prefix[mx];
void prefix_array(string s)
{
int l = s.length();
for(int i=1; i<l; i++)
{
int j = prefix[i-1];
while(j>0 && s[i]!=s[j])
{
j = prefix[j-1];
}
if(s[i]==s[j])
{
j++;
}
prefix[i] = j;
}
}
int main()
{
while(scanf("%s",arr))
{
int l= strlen(arr);
if(arr[0]=='.')
break;
prefix_array(arr);
int d = l - prefix[l-1];
if(l%d==0)
{
cout << l/d << endl;
}
else
{
cout << 1 << endl;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1068 ms |
1884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1068 ms |
1884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1068 ms |
1884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1068 ms |
1884 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |