結果

問題 No.2419 MMA文字列2
ユーザー noriocnorioc
提出日時 2023-08-12 16:43:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 863 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,416 KB
実行使用メモリ 78,272 KB
最終ジャッジ日時 2024-04-30 11:41:45
合計ジャッジ時間 10,154 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
64,340 KB
testcase_01 AC 58 ms
64,268 KB
testcase_02 AC 61 ms
64,988 KB
testcase_03 AC 72 ms
70,008 KB
testcase_04 AC 65 ms
66,856 KB
testcase_05 AC 59 ms
64,932 KB
testcase_06 AC 58 ms
64,072 KB
testcase_07 AC 58 ms
64,208 KB
testcase_08 AC 58 ms
65,940 KB
testcase_09 AC 57 ms
64,808 KB
testcase_10 AC 58 ms
64,688 KB
testcase_11 AC 63 ms
67,672 KB
testcase_12 AC 259 ms
78,072 KB
testcase_13 AC 109 ms
77,508 KB
testcase_14 AC 407 ms
77,808 KB
testcase_15 AC 283 ms
78,136 KB
testcase_16 AC 434 ms
77,900 KB
testcase_17 AC 182 ms
77,708 KB
testcase_18 AC 443 ms
77,820 KB
testcase_19 AC 442 ms
77,848 KB
testcase_20 AC 203 ms
77,688 KB
testcase_21 AC 166 ms
77,712 KB
testcase_22 AC 348 ms
78,016 KB
testcase_23 AC 347 ms
78,140 KB
testcase_24 AC 317 ms
77,900 KB
testcase_25 AC 328 ms
78,084 KB
testcase_26 AC 99 ms
77,268 KB
testcase_27 AC 270 ms
77,436 KB
testcase_28 AC 851 ms
78,048 KB
testcase_29 AC 861 ms
78,152 KB
testcase_30 AC 863 ms
78,272 KB
testcase_31 AC 861 ms
78,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from string import ascii_uppercase
from math import comb

S = input()

freq = Counter()
ans = 0
for c in S:
    for a in ascii_uppercase:
        if a == c: continue
        ans += comb(freq[a], 2)
    freq[c] += 1

print(ans)
0