結果

問題 No.3110 Like CPCTF?
ユーザー hato336
提出日時 2025-04-18 21:01:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 440 ms / 2,000 ms
コード長 756 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 79,144 KB
最終ジャッジ日時 2025-04-18 21:01:47
合計ジャッジ時間 7,206 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = list(input().rstrip())
ans = 0
import string
for a in string.ascii_uppercase:
    for b in string.ascii_uppercase:
        for c in string.ascii_uppercase:
            for d in string.ascii_uppercase:
                if a == b or a == c or a == d or b == c or b == d or c == d:continue
                temp = [0 for j in range(5)]
                for i in s:
                    if i == a:
                        temp[2] += temp[1]
                        temp[0] += 1
                    if i == b:
                        temp[1] += temp[0]
                    if i == c:
                        temp[3] += temp[2]
                    if i == d:
                        temp[4] += temp[3]
                ans += temp[-1]
print(ans)
0