Submission #62765187


Source Code Expand

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

#define all(v) v.begin(),v.end()
#define resort(v) sort(v.rbegin(),v.rend())
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll,ll>;
using vp=vector<pair<ll, ll>>;

const ll inf=1ll<<60;
#define mod10 (ll)1e9+7
#define mod99 (ll)998244353
const double PI = acos(-1);

#define rep(i,n) for (ll i=0;i<n;++i)
#define per(i,n) for(ll i=n-1;i>=0;--i)
#define rep2(i,a,n) for (ll i=a;i<n;++i)
#define per2(i,a,n) for (ll i=n-1;i>=a;--i)


template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

ll dx[] = {1, 0, -1, 0, -1, 1, -1, 1};
ll dy[] = {0, 1, 0, -1, -1, 1, 1, -1};

void solve() {
    string s; cin >> s;
    int n = s.size();
    int ans = 0;
    rep(i, n) {
        rep2(j, i+1, n) {
            int d = j - i;
            int k = j + d;
            if(k >= n) continue;
            if (s[i] == 'A' && s[j] == 'B' && s[k] == 'C') {
                ans++;
            }
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int t=1;
    //cin >> t;
    while(t--)solve();
}

Submission Info

Submission Time
Task B - A..B..C
User ardRiriy
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1344 Byte
Status AC
Exec Time 1 ms
Memory 3616 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 23
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_random2_00.txt, 02_random2_01.txt, 02_random2_02.txt, 02_random2_03.txt, 03_handmade_00.txt, 03_handmade_01.txt, 03_handmade_02.txt, 03_handmade_03.txt, 03_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3416 KiB
00_sample_01.txt AC 1 ms 3388 KiB
00_sample_02.txt AC 1 ms 3488 KiB
01_random_00.txt AC 1 ms 3616 KiB
01_random_01.txt AC 1 ms 3496 KiB
01_random_02.txt AC 1 ms 3488 KiB
01_random_03.txt AC 1 ms 3416 KiB
01_random_04.txt AC 1 ms 3392 KiB
01_random_05.txt AC 1 ms 3384 KiB
01_random_06.txt AC 1 ms 3420 KiB
01_random_07.txt AC 1 ms 3472 KiB
01_random_08.txt AC 1 ms 3444 KiB
01_random_09.txt AC 1 ms 3488 KiB
01_random_10.txt AC 1 ms 3420 KiB
02_random2_00.txt AC 1 ms 3344 KiB
02_random2_01.txt AC 1 ms 3436 KiB
02_random2_02.txt AC 1 ms 3420 KiB
02_random2_03.txt AC 1 ms 3500 KiB
03_handmade_00.txt AC 1 ms 3488 KiB
03_handmade_01.txt AC 1 ms 3488 KiB
03_handmade_02.txt AC 1 ms 3496 KiB
03_handmade_03.txt AC 1 ms 3560 KiB
03_handmade_04.txt AC 1 ms 3500 KiB