結果

問題 No.852 連続部分文字列
ユーザー tanon710
提出日時 2019-07-26 23:16:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 222 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,356 KB
最終ジャッジ日時 2024-07-02 09:32:54
合計ジャッジ時間 9,009 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 WA * 39
権限があれば一括ダウンロードができます

ソースコード

diff #

s=input()
l=len(s)
t=set()
v=[0]
tmp=0
for i in range(l):
    if s[-(i+1)] not in t:
        t.add(s[-(i+1)])
        tmp+=1
    v.append(tmp)
ans=0
for i in range(1,l+1):
    ans+=v[i]*(l-i+1)
ans/=(l*(l+1))//2
print(ans)
0