結果

問題 No.852 連続部分文字列
ユーザー convexineqconvexineq
提出日時 2021-03-26 05:01:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 236 ms / 3,153 ms
コード長 248 bytes
コンパイル時間 693 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 206,312 KB
最終ジャッジ日時 2023-08-18 10:15:48
合計ジャッジ時間 8,592 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,132 KB
testcase_01 AC 68 ms
71,092 KB
testcase_02 AC 71 ms
71,404 KB
testcase_03 AC 70 ms
71,096 KB
testcase_04 AC 68 ms
71,100 KB
testcase_05 AC 69 ms
71,392 KB
testcase_06 AC 69 ms
71,192 KB
testcase_07 AC 69 ms
71,200 KB
testcase_08 AC 68 ms
71,380 KB
testcase_09 AC 69 ms
71,376 KB
testcase_10 AC 69 ms
71,444 KB
testcase_11 AC 69 ms
71,232 KB
testcase_12 AC 70 ms
71,376 KB
testcase_13 AC 76 ms
76,272 KB
testcase_14 AC 76 ms
75,840 KB
testcase_15 AC 79 ms
77,564 KB
testcase_16 AC 76 ms
76,180 KB
testcase_17 AC 78 ms
76,904 KB
testcase_18 AC 79 ms
77,676 KB
testcase_19 AC 75 ms
76,076 KB
testcase_20 AC 75 ms
76,076 KB
testcase_21 AC 79 ms
77,796 KB
testcase_22 AC 76 ms
75,972 KB
testcase_23 AC 78 ms
76,892 KB
testcase_24 AC 77 ms
75,844 KB
testcase_25 AC 76 ms
76,684 KB
testcase_26 AC 79 ms
77,956 KB
testcase_27 AC 76 ms
76,532 KB
testcase_28 AC 77 ms
77,148 KB
testcase_29 AC 80 ms
77,764 KB
testcase_30 AC 74 ms
76,120 KB
testcase_31 AC 80 ms
77,908 KB
testcase_32 AC 81 ms
78,308 KB
testcase_33 AC 233 ms
171,104 KB
testcase_34 AC 234 ms
171,208 KB
testcase_35 AC 230 ms
171,016 KB
testcase_36 AC 226 ms
171,152 KB
testcase_37 AC 229 ms
170,828 KB
testcase_38 AC 227 ms
171,436 KB
testcase_39 AC 229 ms
171,052 KB
testcase_40 AC 236 ms
171,168 KB
testcase_41 AC 228 ms
170,876 KB
testcase_42 AC 231 ms
169,944 KB
testcase_43 AC 230 ms
206,312 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

*s, = map(ord,input())
n = len(s)
res = [[-1] for _ in range(26)]
for i,si in enumerate(s):
    res[si-97].append(i)
cnt = 26*n*(n+1)//2
for r in res:
    r.append(n)
    for a,b in zip(r,r[1:]):
        cnt -= (b-a)*(b-a-1)//2
print(cnt*2/n/(n+1))
0