結果
| 問題 | No.3655 Adjacent Pairs in Triplets |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 14:06:07 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| + 685µs | |
| コード長 | 656 bytes |
| 記録 | |
| コンパイル時間 | 2,007 ms |
| コンパイル使用メモリ | 331,220 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-30 14:06:52 |
| 合計ジャッジ時間 | 3,670 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
int solve(void) {
string S;
cin >> S;
const int N = S.size();
auto check = [&](string T) {
int b1 = (T[0] == T[1]);
int b2 = (T[1] == T[2]);
return (b1 ^ b2);
};
int cnt = 0;
rep(i, N - 2) if(check(S.substr(i, 3))) cnt += 1;
cout << cnt << "\n";
return 0;
}
signed main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int Testcases = 1;
//cin >> Testcases;
while(Testcases--) solve();
return 0;
}