結果
| 問題 | 
                            No.3110 Like CPCTF?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-04-21 08:25:34 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 169 ms / 2,000 ms | 
| コード長 | 297 bytes | 
| コンパイル時間 | 346 ms | 
| コンパイル使用メモリ | 82,592 KB | 
| 実行使用メモリ | 77,124 KB | 
| 最終ジャッジ日時 | 2025-04-21 08:25:38 | 
| 合計ジャッジ時間 | 3,154 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 | 
ソースコード
from itertools import combinations
from collections import Counter
N=int(input())
S=list(map(str, input()))
ans = 0
for com in combinations(S, 5):
    C=Counter(com)
    if com[0] == com[2] and C[com[0]] == 2 and C[com[1]] == 1 and C[com[3]] == 1 and C[com[4]] == 1:
        ans += 1
print(ans)