Given a string, we need to find the total number of its distinct substrings.
給一個字串,我們需要找到不同子字串的總數
T- number of test cases. T<=50;
Each test case consists of one string, whose length is <= 5000
第一行會有一個整數T,代表接下來會有幾筆測資 T ≦ 50
接下來每組的測試字串長度 L ≦ 5000
2 CCCCC ABABA
5 9
Explanation for the testcase with string ABABA:
len=1 : A,B
len=2 : AB,BA
len=3 : ABA,BAB
len=4 : ABAB,BABA
len=5 : ABABA
Thus, total number of distinct substrings is 9.
Added by: | Prasanna |
Date: | 2006-01-13 |
Time limit: | 1s |
Source limit: | 50000B |
Languages: | All except: PERL 6 |
Resource: | ByteCode '06 |
×數據範圍稍作修改
編號 | 身分 | 題目 | 主題 | 人氣 | 發表日期 |
沒有發現任何「解題報告」
|