結果
問題 |
No.3110 Like CPCTF?
|
ユーザー |
|
提出日時 | 2025-04-09 23:10:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 134 ms / 2,000 ms |
コード長 | 642 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 76,348 KB |
最終ジャッジ日時 | 2025-04-18 19:30:41 |
合計ジャッジ時間 | 2,017 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)