結果

問題 No.2738 CPC To F
ユーザー gew1fw
提出日時 2025-06-12 15:16:44
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 66,176 KB
最終ジャッジ日時 2025-06-12 15:16:47
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input().strip()

count_cpctf = 0
count_cpctcpc = 0

for i in range(n - 4):
    # Check for "CPCTF"
    if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'F':
        count_cpctf += 1

for i in range(n - 6):
    # Check for "CPCTCPC"
    if (s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and
        s[i+3] == 'T' and s[i+4] == 'C' and s[i+5] == 'P' and s[i+6] == 'C'):
        count_cpctcpc += 1

print(count_cpctf + count_cpctcpc)
0