提出 #62779842


ソースコード 拡げる

#include <bits/stdc++.h>
#include <bitset>
#include <cmath>
#define ll long long
using namespace std;
#define vl vector<ll>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define yes cout << "YES\n"
#define no cout << "NO\n"

const int N = 1e9+7;
void solve(){
    string s;
    cin>>s;
    int ans = 0;
    for(int i = 0 ; i < s.size() ; i++){
        if(s[i] == 'A'){
            for(int diff = 1 ; 2*diff + i < s.size() ; diff++){
                if(s[diff + i] == 'B' && s[2*diff + i] == 'C') ans++;
            }
        }
    }
    cout<<ans<<endl;
}

int main() {
    int T = 1;
    //cin >> T;
    while (T--) {
        solve();
    }
}

提出情報

提出日時
問題 B - A..B..C
ユーザ MrBlack005
言語 C++ 20 (gcc 12.2)
得点 200
コード長 695 Byte
結果 AC
実行時間 2 ms
メモリ 3656 KiB

コンパイルエラー

Main.cpp: In function ‘void solve()’:
Main.cpp:18:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   18 |     for(int i = 0 ; i < s.size() ; i++){
      |                     ~~^~~~~~~~~~
Main.cpp:20:43: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   20 |             for(int diff = 1 ; 2*diff + i < s.size() ; diff++){
      |                                ~~~~~~~~~~~^~~~~~~~~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 23
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3532 KiB
00_sample_01.txt AC 1 ms 3364 KiB
00_sample_02.txt AC 1 ms 3364 KiB
01_random_00.txt AC 1 ms 3652 KiB
01_random_01.txt AC 1 ms 3516 KiB
01_random_02.txt AC 1 ms 3504 KiB
01_random_03.txt AC 1 ms 3656 KiB
01_random_04.txt AC 1 ms 3524 KiB
01_random_05.txt AC 1 ms 3648 KiB
01_random_06.txt AC 1 ms 3652 KiB
01_random_07.txt AC 1 ms 3652 KiB
01_random_08.txt AC 1 ms 3496 KiB
01_random_09.txt AC 2 ms 3500 KiB
01_random_10.txt AC 1 ms 3520 KiB
02_random2_00.txt AC 1 ms 3364 KiB
02_random2_01.txt AC 1 ms 3328 KiB
02_random2_02.txt AC 1 ms 3652 KiB
02_random2_03.txt AC 1 ms 3496 KiB
03_handmade_00.txt AC 1 ms 3532 KiB
03_handmade_01.txt AC 1 ms 3564 KiB
03_handmade_02.txt AC 1 ms 3500 KiB
03_handmade_03.txt AC 1 ms 3456 KiB
03_handmade_04.txt AC 1 ms 3536 KiB