結果

問題 No.2738 CPC To F
ユーザー Theta
提出日時 2024-04-23 17:25:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 506 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 82,908 KB
最終ジャッジ日時 2024-10-15 17:59:08
合計ジャッジ時間 4,240 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    S = input()
    idx = -1
    ctr = 0
    while idx < N:
        search_idx = S.find("CPCT", idx + 1)
        if search_idx == -1:
            break
        if search_idx + 4 >= N:
            break
        if S[search_idx + 4] == "F":
            ctr += 1
            idx = search_idx
            continue
        if S[search_idx + 4:search_idx + 7] == "CPC":
            ctr += 1
            idx = search_idx + 4
    print(ctr)


if __name__ == "__main__":
    main()
0