結果

問題 No.2738 CPC To F
ユーザー Yuzuki SakashitaYuzuki Sakashita
提出日時 2024-04-21 13:21:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 677 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 71,012 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-21 13:22:04
合計ジャッジ時間 4,260 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,752 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

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