結果

問題 No.2738 CPC To F
ユーザー Yuzuki SakashitaYuzuki Sakashita
提出日時 2024-04-21 13:28:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 674 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 70,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 13:28:19
合計ジャッジ時間 1,714 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>

using namespace std;

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

    int cnt = 0;
    char* ptr = &S[0];

    while (*(ptr + 3) && *(ptr + 1)) {
        if (*ptr == 'T' && *(ptr - 1) == 'C' && *(ptr - 2) == 'P' && *(ptr - 3) == 'C') {
            if (*(ptr + 1) == 'F') {
                cnt++;
                ptr += 5;
            } else if (*(ptr + 1) == 'C' && *(ptr + 2) == 'P' && *(ptr + 3) == 'C') {
                cnt++;
                ptr += 7;
            } else {
                ptr += 4;
            }
        } else {
            ptr++;
        }
    }

    cout << cnt << endl;

    return 0;
}
0