結果

問題 No.2419 MMA文字列2
ユーザー dmasuprodmasupro
提出日時 2023-08-14 20:56:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 448 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 490,436 KB
最終ジャッジ日時 2024-05-02 09:04:21
合計ジャッジ時間 15,663 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 39 ms
52,096 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 39 ms
51,584 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 69 ms
81,860 KB
testcase_27 AC 230 ms
148,712 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
alpha_set = set(list(S))
A = [{s:0 for s in alpha_set} for _ in range(len(S)+1)]
for i, s in enumerate(S):
    i += 1
    for key in alpha_set:
        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]
#     for key in A[i]:
#         if s == key:
#             continue
#         ans += A[i][key]*(A[i][key]-1)//2
        # print(s,key, A[i][key]*(A[i][key]-1)//2)
print(ans)
0