結果

問題 No.2419 MMA文字列2
ユーザー dmasuprodmasupro
提出日時 2023-08-12 15:29:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 347 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,856 KB
実行使用メモリ 268,780 KB
最終ジャッジ日時 2024-04-30 09:30:44
合計ジャッジ時間 4,466 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
62,352 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 37 ms
54,180 KB
testcase_06 WA -
testcase_07 AC 37 ms
53,480 KB
testcase_08 WA -
testcase_09 AC 40 ms
54,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
S = input()
A = [{s:0 for s in set(list(S))} for _ in range(len(S)+1)]
for i, s in enumerate(S):
    i += 1
    for key in A[i]:
        A[i][key] += A[i-1][key] 
    A[i][s] += 1 
# print(A[-1])
ans = 0
for i in  range(len(S)):
    s = S[i]
    if A[i][s] >= 1:
        ans +=  A[i][s]*(len(S) - 1 - i )
print(ans)
0