結果

問題 No.3110 Like CPCTF?
ユーザー Ka1chiX_m
提出日時 2025-04-18 23:11:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 12,288 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-04-18 23:11:56
合計ジャッジ時間 1,344 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

n = int(input())
s = input()

if n <= 4:
    print(0)

def count_valid_combinations(s):
    count = 0
    for combo in combinations(s, 5):
        if combo[0] != combo[2]:
            continue
        if len(set(combo)) == 4:
            count += 1
    return count
    
if n>= 5:
    print(count_valid_combinations(s))
    
0