結果
| 問題 |
No.3110 Like CPCTF?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-20 11:01:53 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,053 bytes |
| コンパイル時間 | 448 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-04-20 11:01:55 |
| 合計ジャッジ時間 | 1,694 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 16 |
ソースコード
def count_cpctf_substrings(s):
n = len(s)
count = 0
# 5つの位置を選ぶすべての組み合わせを考える
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):
# 選んだ5文字
sub = [s[i], s[j], s[k], s[l], s[m]]
# CPCTF的かどうかを判定
# 1文字目と3文字目が等しい
if sub[0] == sub[2]:
# それ以外の文字はすべて異なる
if (sub[0] != sub[1] and sub[0] != sub[3] and sub[0] != sub[4] and
sub[1] != sub[2] and sub[1] != sub[3] and sub[1] != sub[4] and
sub[2] != sub[3] and sub[2] != sub[4] and
sub[3] != sub[4]):
count += 1
return count