結果
問題 |
No.3110 Like CPCTF?
|
ユーザー |
|
提出日時 | 2025-04-18 23:43:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 862 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,112 KB |
最終ジャッジ日時 | 2025-04-18 23:43:31 |
合計ジャッジ時間 | 2,234 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
def solve(n, s): count = 0 # Try all possible combinations of 5 positions for i in range(n): for j in range(i+1, n): for k in range(j+1, n): for l in range(k+1, n): for m in range(l+1, n): # Check if characters at positions i and k are equal (1st and 3rd positions) if s[i] == s[k]: # Check if all other characters are different if s[j] != s[i] and s[l] != s[i] and s[m] != s[i] and s[j] != s[l] and s[j] != s[m] and s[l] != s[m]: count += 1 return count # Read input n = int(input()) s = input() print(solve(n, s))