結果
| 問題 |
No.2738 CPC To F
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:51:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 597 bytes |
| コンパイル時間 | 171 ms |
| コンパイル使用メモリ | 82,384 KB |
| 実行使用メモリ | 75,364 KB |
| 最終ジャッジ日時 | 2025-06-12 19:51:29 |
| 合計ジャッジ時間 | 2,312 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 17 |
ソースコード
n = int(input())
s = input().strip()
count_original = 0
for i in range(4, n):
if s[i] == 'F' and s[i-4] == 'C' and s[i-3] == 'P' and s[i-2] == 'C' and s[i-1] == 'T':
count_original += 1
candidates = []
for i in range(n - 2):
if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C':
if i >= 4 and s[i-4] == 'C' and s[i-3] == 'P' and s[i-2] == 'C' and s[i-1] == 'T':
candidates.append(i)
count_replaced = 0
current_end = -1
for i in candidates:
if i >= current_end:
count_replaced += 1
current_end = i + 3
print(count_original + count_replaced)
gew1fw