結果

問題 No.852 連続部分文字列
ユーザー kekurekekure
提出日時 2019-10-13 21:40:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 325 bytes
コンパイル時間 321 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 844,228 KB
最終ジャッジ日時 2023-08-22 16:31:26
合計ジャッジ時間 5,580 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,404 KB
testcase_01 AC 69 ms
71,260 KB
testcase_02 AC 73 ms
71,576 KB
testcase_03 WA -
testcase_04 AC 69 ms
71,516 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 74 ms
75,140 KB
testcase_09 AC 69 ms
71,200 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 MLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
l = len(S)

dp = [[1 for i in range(l)] for j in range(l)]

sum_v = 0
for i in range(0, l):
    for j in range(i + 1, l):
        if S[j] in S[i:j - 1]:
            dp[i][j] = dp[i][j - 1]
        else:
            dp[i][j] = dp[i][j - 1] + 1
        sum_v += dp[i][j]

n = l * (l + 1) / 2
print((sum_v + l) / n)
0