結果

問題 No.852 連続部分文字列
ユーザー amyuamyu
提出日時 2019-07-26 21:57:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 532 ms / 3,153 ms
コード長 178 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 10,656 KB
実行使用メモリ 48,672 KB
最終ジャッジ日時 2023-09-15 01:18:07
合計ジャッジ時間 8,219 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,380 KB
testcase_01 AC 17 ms
8,372 KB
testcase_02 AC 19 ms
8,372 KB
testcase_03 AC 18 ms
8,380 KB
testcase_04 AC 17 ms
8,368 KB
testcase_05 AC 17 ms
8,388 KB
testcase_06 AC 18 ms
8,392 KB
testcase_07 AC 18 ms
8,408 KB
testcase_08 AC 17 ms
8,448 KB
testcase_09 AC 18 ms
8,440 KB
testcase_10 AC 17 ms
8,388 KB
testcase_11 AC 17 ms
8,340 KB
testcase_12 AC 18 ms
8,448 KB
testcase_13 AC 26 ms
9,080 KB
testcase_14 AC 21 ms
8,712 KB
testcase_15 AC 33 ms
9,540 KB
testcase_16 AC 25 ms
9,016 KB
testcase_17 AC 28 ms
9,168 KB
testcase_18 AC 32 ms
9,656 KB
testcase_19 AC 18 ms
8,492 KB
testcase_20 AC 23 ms
8,896 KB
testcase_21 AC 32 ms
9,592 KB
testcase_22 AC 21 ms
8,796 KB
testcase_23 AC 27 ms
9,244 KB
testcase_24 AC 22 ms
8,944 KB
testcase_25 AC 27 ms
9,048 KB
testcase_26 AC 31 ms
9,652 KB
testcase_27 AC 25 ms
9,024 KB
testcase_28 AC 28 ms
9,108 KB
testcase_29 AC 32 ms
9,588 KB
testcase_30 AC 19 ms
8,652 KB
testcase_31 AC 32 ms
9,452 KB
testcase_32 AC 33 ms
9,784 KB
testcase_33 AC 520 ms
48,544 KB
testcase_34 AC 517 ms
48,560 KB
testcase_35 AC 517 ms
48,524 KB
testcase_36 AC 515 ms
48,504 KB
testcase_37 AC 532 ms
48,320 KB
testcase_38 AC 526 ms
48,396 KB
testcase_39 AC 516 ms
48,300 KB
testcase_40 AC 528 ms
48,672 KB
testcase_41 AC 527 ms
48,568 KB
testcase_42 AC 524 ms
48,556 KB
testcase_43 AC 529 ms
48,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
s=input()
n=len(s)
dp=[0]*(n+1)
dic=collections.defaultdict(int)
for i,S in enumerate(s,1):
    dp[i]=dp[i-1]+i-dic[S]
    dic[S]=i
print(sum(dp)/(n*(n+1)//2))
0