結果

問題 No.3655 Adjacent Pairs in Triplets
コンテスト
ユーザー 後藤 響_Goto Toyomu
提出日時 2026-08-30 13:49:59
言語 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
結果
WA  
実行時間 -
コード長 1,416 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,219 ms
コンパイル使用メモリ 352,568 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-08-30 13:50:04
合計ジャッジ時間 4,141 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

// 型定義
#define ull unsigned long long
#define ll long long
#define ul unsigned long
using P = pair<ll, ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;

// ループマクロ
#define FOR(i, l, r) for(size_t i = (l); i < (r); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; --i)
#define rfor(v, vec) for(auto &v : (vec))
#define itrloop(itr, begin, end) for(auto itr = (begin); itr != end; ++itr)
#define crfor(v, vec) for(const auto &v : (vec))

// イテレータマクロ
#define all(x) x.begin(), x.end()
#define call(x) x.cbegin(), x.cend()
#define rall(x) x.rbegin(), x.rend()

// 便利関数 (chmin / chmax)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 定数
const ll INF = 1LL << 60; // 十分大きな値(約10^18)
#define el '\n'
void solve() {
    string S;
cin>>S;
ll p=S.size();
ll pre=0;
rep(i,p-2){
    if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+2]==S[i+1] ){
        if(S[i]==S[i+1]&&S[i]==S[i+2] &&S[i+2]==S[i+1]){

        }else{
        pre++;

        }
    }
}
cout<<pre<<el;

    
}
// Generated by 3.0.1 https://github.com/kyuridenamida/atcoder-tools
int main(){

    cout << fixed << setprecision(15);
    solve();
    return 0;
}
0