結果
問題 |
No.2738 CPC To F
|
ユーザー |
![]() |
提出日時 | 2025-06-12 14:54:06 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 344 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 75,108 KB |
最終ジャッジ日時 | 2025-06-12 14:57:08 |
合計ジャッジ時間 | 2,302 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)