結果
問題 |
No.852 連続部分文字列
|
ユーザー |
![]() |
提出日時 | 2021-03-26 05:01:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 237 ms / 3,153 ms |
コード長 | 248 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 197,924 KB |
最終ジャッジ日時 | 2024-11-27 14:22:53 |
合計ジャッジ時間 | 6,584 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
*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))