結果
問題 |
No.2738 CPC To F
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:18:05 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 81,820 KB |
実行使用メモリ | 71,136 KB |
最終ジャッジ日時 | 2025-04-16 16:19:01 |
合計ジャッジ時間 | 2,318 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 17 |
ソースコード
n = int(input()) s = input().strip() marked = [False] * n original_count = 0 # Find all original CPCTF and mark their CPC parts for i in range(len(s) - 4): if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'F': original_count += 1 marked[i] = True marked[i+1] = True marked[i+2] = True additional_count = 0 # Check each CPC in the original string for j in range(len(s) - 2): if s[j] == 'C' and s[j+1] == 'P' and s[j+2] == 'C': # Check if any part of this CPC is marked if marked[j] or marked[j+1] or marked[j+2]: continue # Check if preceded by CPCT if j >= 4: if s[j-4] == 'C' and s[j-3] == 'P' and s[j-2] == 'C' and s[j-1] == 'T': additional_count += 1 print(original_count + additional_count)