码迷,mamicode.com
首页 > 其他好文 > 详细

BNUOJ 7629 Boring counting

时间:2014-08-22 23:45:39      阅读:187      评论:0      收藏:0      [点我收藏+]

标签:style   http   java   os   io   for   ar   div   amp   

Boring counting

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 3518
64-bit integer IO format: %I64d      Java class name: Main
 
 
035 now faced a tough problem,his english teacher gives him a string,which consists with n lower case letter,he must figure out how many substrings appear at least twice,moreover,such apearances can not overlap each other.
Take aaaa as an example.”a” apears four times,”aa” apears two times without overlaping.however,aaa can’t apear more than one time without overlaping.since we can get “aaa” from [0-2](The position of string begins with 0) and [1-3]. But the interval [0-2] and [1-3] overlaps each other.So “aaa” can not take into account.Therefore,the answer is 2(“a”,and “aa”).
 

Input

The input data consist with several test cases.The input ends with a line “#”.each test case contain a string consists with lower letter,the length n won’t exceed 1000(n <= 1000).
 

Output

For each test case output an integer ans,which represent the answer for the test case.you’d better use int64 to avoid unnecessary trouble.
 

Sample Input

aaaa
ababcabb
aaaaaa
#

Sample Output

2
3
3

Source

 
 
解题:后缀数组。。。。后缀数组学习中
 

BNUOJ 7629 Boring counting

标签:style   http   java   os   io   for   ar   div   amp   

原文地址:http://www.cnblogs.com/crackpotisback/p/3930337.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!