結果

問題 No.2738 CPC To F
ユーザー shima113
提出日時 2024-04-21 14:25:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 72,860 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 13:09:48
合計ジャッジ時間 1,699 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <algorithm>

using namespace std;


int main() {
    int n; string s;
    cin >> n >> s;

    int count = 0;

    for (int i = s.size() - 1; i >= 6; i--) {
        //cout << "Yo";
        if(s.substr(i - 6, 7) == "CPCTCPC"){
            s.replace(i - 6, 7, "CPCTF");
            //cout << s << endl;
        }
    }

    for (int i = s.size() - 1; i >= 4; i--) {
        //cout << "Yo";
        if(s.substr(i - 4, 5) == "CPCTF"){
            count++;
            //cout << s << i << endl;
        }
    }

    cout << count;
    return 0;
}
0