結果
| 問題 | 
                            No.3110 Like CPCTF?
                             | 
                    
| コンテスト | |
| ユーザー | 
                             回転
                         | 
                    
| 提出日時 | 2025-04-25 20:24:59 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 89 ms / 2,000 ms | 
| コード長 | 228 bytes | 
| コンパイル時間 | 445 ms | 
| コンパイル使用メモリ | 82,576 KB | 
| 実行使用メモリ | 76,448 KB | 
| 最終ジャッジ日時 | 2025-04-25 20:25:02 | 
| 合計ジャッジ時間 | 2,406 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 16 | 
ソースコード
from itertools import combinations
N = int(input())
S = input()
ans = 0
for a,b,c,d,e in combinations(range(N),5):
    if(len(set([S[a],S[b],S[c],S[d],S[e]])) != 4):continue
    if(S[a] != S[c]):continue
    ans += 1
print(ans)
            
            
            
        
            
回転