Submission #62797491


Source Code Expand

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

int main() {
    string S;
    cin >> S;
    int cnt = 0;
    for (int i = 0; i < S.size(); i++) {
        for (int j = 1; j < S.size(); j++) {
            string s = "";
            for (int k = i; k < i + 2 * j + 1 && k < S.size(); k += j) {
                s += S[k];
            }
            if (s == "ABC") cnt++;
        }
    }
    cout << cnt << endl;
}

Submission Info

Submission Time
Task B - A..B..C
User thedekopin0108
Language C++ 17 (gcc 12.2)
Score 200
Code Size 428 Byte
Status AC
Exec Time 1 ms
Memory 3656 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:8:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    8 |     for (int i = 0; i < S.size(); i++) {
      |                     ~~^~~~~~~~~~
Main.cpp:9:27: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    9 |         for (int j = 1; j < S.size(); j++) {
      |                         ~~^~~~~~~~~~
Main.cpp:11:52: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   11 |             for (int k = i; k < i + 2 * j + 1 && k < S.size(); k += j) {
      |                                                  ~~^~~~~~~~~~

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 3440 KiB
00_sample_01.txt AC 1 ms 3440 KiB
00_sample_02.txt AC 1 ms 3496 KiB
01_random_00.txt AC 1 ms 3656 KiB
01_random_01.txt AC 1 ms 3524 KiB
01_random_02.txt AC 1 ms 3648 KiB
01_random_03.txt AC 1 ms 3648 KiB
01_random_04.txt AC 1 ms 3460 KiB
01_random_05.txt AC 1 ms 3432 KiB
01_random_06.txt AC 1 ms 3428 KiB
01_random_07.txt AC 1 ms 3368 KiB
01_random_08.txt AC 1 ms 3460 KiB
01_random_09.txt AC 1 ms 3500 KiB
01_random_10.txt AC 1 ms 3496 KiB
02_random2_00.txt AC 1 ms 3428 KiB
02_random2_01.txt AC 1 ms 3572 KiB
02_random2_02.txt AC 1 ms 3472 KiB
02_random2_03.txt AC 1 ms 3524 KiB
03_handmade_00.txt AC 1 ms 3504 KiB
03_handmade_01.txt AC 1 ms 3464 KiB
03_handmade_02.txt AC 1 ms 3440 KiB
03_handmade_03.txt AC 1 ms 3436 KiB
03_handmade_04.txt AC 1 ms 3500 KiB