結果
問題 |
No.2738 CPC To F
|
ユーザー |
|
提出日時 | 2024-04-23 17:33:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 52 ms / 2,000 ms |
コード長 | 552 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 81,536 KB |
実行使用メモリ | 61,440 KB |
最終ジャッジ日時 | 2024-10-15 18:07:34 |
合計ジャッジ時間 | 2,301 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
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 + 6 continue idx = search_idx print(ctr) if __name__ == "__main__": main()