結果

問題 No.3110 Like CPCTF?
ユーザー Rira
提出日時 2025-04-19 03:49:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 565 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 68,184 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-19 03:49:35
合計ジャッジ時間 1,835 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 6 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

int count_cpctf_substrings(const string &S) {
    int N = S.length();
    int count = 0;
    
    for (int i = 0; i <= N - 5; ++i) {
        string substring = S.substr(i, 5);
        
        if(substring[0] == substring[2] &&
           substring[1] != substring[3] && substring[1] != substring[4] && substring[3] != substring[4]) {
           	count++;
           }
    }
    
    return count;
}

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

    cout << count_cpctf_substrings(S) << endl;
    return 0;
}
0