結果
問題 |
No.3110 Like CPCTF?
|
ユーザー |
|
提出日時 | 2025-04-09 23:09:37 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,240 KB |
最終ジャッジ日時 | 2025-04-18 19:30:44 |
合計ジャッジ時間 | 2,440 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
# ライブラリのインポート from itertools import combinations # 入力の受け取り n = int(input()) s = input() # 答えの数を計算 ans = 0 for p in combinations(range(n), 5): # 5文字の組み合わせを取得 a = s[p[0]] b = s[p[1]] c = s[p[2]] d = s[p[3]] e = s[p[4]] # 条件を満たすかチェック is_ok = True if a == b or a != c or a == d or a == e: is_ok = False if b == c or b == d or b == e: is_ok = False if c == d or c == e: is_ok = False if d == e: is_ok = False if is_ok: ans += 1 # 答えを出力 print(ans)