結果

問題 No.852 連続部分文字列
ユーザー kohei2019kohei2019
提出日時 2022-05-04 12:26:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 327 ms / 3,153 ms
コード長 326 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 78,096 KB
最終ジャッジ日時 2023-09-16 14:29:27
合計ジャッジ時間 9,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,352 KB
testcase_01 AC 68 ms
71,232 KB
testcase_02 AC 68 ms
71,216 KB
testcase_03 AC 69 ms
71,256 KB
testcase_04 AC 68 ms
71,316 KB
testcase_05 AC 72 ms
75,984 KB
testcase_06 AC 74 ms
75,688 KB
testcase_07 AC 73 ms
75,692 KB
testcase_08 AC 71 ms
71,512 KB
testcase_09 AC 70 ms
71,184 KB
testcase_10 AC 72 ms
75,784 KB
testcase_11 AC 71 ms
71,272 KB
testcase_12 AC 75 ms
75,568 KB
testcase_13 AC 81 ms
76,432 KB
testcase_14 AC 79 ms
75,732 KB
testcase_15 AC 89 ms
76,504 KB
testcase_16 AC 83 ms
76,228 KB
testcase_17 AC 84 ms
76,360 KB
testcase_18 AC 87 ms
76,228 KB
testcase_19 AC 75 ms
75,720 KB
testcase_20 AC 80 ms
76,084 KB
testcase_21 AC 86 ms
76,444 KB
testcase_22 AC 80 ms
76,084 KB
testcase_23 AC 83 ms
76,344 KB
testcase_24 AC 78 ms
75,940 KB
testcase_25 AC 79 ms
76,416 KB
testcase_26 AC 85 ms
76,392 KB
testcase_27 AC 82 ms
76,604 KB
testcase_28 AC 84 ms
76,448 KB
testcase_29 AC 83 ms
76,388 KB
testcase_30 AC 75 ms
75,964 KB
testcase_31 AC 84 ms
76,460 KB
testcase_32 AC 85 ms
76,252 KB
testcase_33 AC 282 ms
78,084 KB
testcase_34 AC 285 ms
77,988 KB
testcase_35 AC 287 ms
78,020 KB
testcase_36 AC 280 ms
77,940 KB
testcase_37 AC 287 ms
77,900 KB
testcase_38 AC 281 ms
77,960 KB
testcase_39 AC 327 ms
77,892 KB
testcase_40 AC 287 ms
77,976 KB
testcase_41 AC 279 ms
77,988 KB
testcase_42 AC 315 ms
78,096 KB
testcase_43 AC 288 ms
78,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
N = len(S)
alp = 'abcdefghijklmnopqrstuvwxyz'
ans = 0
allp = N*(N+1)//2
for i in range(26):
    rm = 0
    cnt = 0
    for j in range(N):
        if S[j] == alp[i]:
            rm += cnt*(cnt+1)//2
            cnt = 0
        else:
            cnt += 1
    rm += cnt*(cnt+1)//2
    ans += (allp-rm)/allp
print(ans)
0