結果

問題 No.2738 CPC To F
ユーザー napolin
提出日時 2024-04-21 13:21:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 677 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 68,444 KB
最終ジャッジ日時 2025-02-21 08:08:23
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;

    int i = 3;
    int cnt = 0;

    while (i < N - 1) {
        char c = S[i];
        if (c != 'T') {
            i++;
            continue;
        }

        if (S.substr(i - 3, 3) == "CPC") {
            if (S[i + 1] == 'F') {
                cnt++;
                i += 5;
            } else if (i + 3 < N && S.substr(i + 1, 3) == "CPC") {
                cnt++;
                i += 7;
            } else {
                continue;
            }
        } else {
            i += 4;
        }
    }

    cout << cnt << endl;

    return 0;
}
0