結果

問題 No.3655 Adjacent Pairs in Triplets
コンテスト
ユーザー aaaaaaaaa
提出日時 2026-08-30 13:56:41
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 4 ms / 2,000 ms
+ 718µs
コード長 490 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,279 ms
コンパイル使用メモリ 350,208 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-30 13:56:46
合計ジャッジ時間 3,667 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

int main() {
    string s;
    cin >> s;
    string sub = s;
    int count = 0;
    for(int i = 0; i < s.size()-2; i++){
        int x = 0;
        if(sub.at(i) == sub.at(i+1)){
            x++;
        }
        if(sub.at(i+1) == sub.at(i+2)){
            x++;
        }
        // if(sub.at(i+2) == sub.at(i+0)){
        //     x++;
        // }

        if(x == 1){
            count++;
        }
    }

    cout << count;

    return 0;
}
0