Problem 1911 --Problem D: Power Strings

1911: Problem D: Power Strings

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $5$ 正确数量 $2$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签

Problem D: Power Strings

Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative integer is defined in the normal way: a^0 = "" (the empty string) and a^(n+1) = a*(a^n).

Each test case is a line of input representing s, a string of printable characters. For each s you should print the largest n such that s = a^n for some string a. The length of s will be at least 1 and will not exceed 1 million characters. A line containing a period follows the last test case.

abcd
aaaa
ababab
.
1
4
3

推荐代码 查看1911 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$172 $ms] AOJ大管家 84426 2017-04-27 15:29:06
内存最少[$2096 $KB] 淡意的温柔 589258 2020-05-31 14:43:24
第一AC AOJ大管家 84426 2017-04-27 15:29:06
第一挑战 AOJ大管家 84426 2017-04-27 15:29:06

赛题来源/所属竞赛 NA N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛