Submission #62767643
Source Code Expand
Copy
#include <bits/stdc++.h>#define ll long long#define ff first#define ss second#define pii pair<int,int>#define pb push_back#define eb emplace_back#define inf INT_MAX#define all(x) x.begin(),x.end()const int MOD = 1e9+7;using namespace std;void solve(){string s;cin>>s;int cnt=0;for (int i = 0; i < s.size(); i++)if (s[i] == 'A')for (int j = 1; 2 * j + i < s.size(); j++)cnt+=(s[i + j] == 'B' && s[i + j + j] == 'C');cout<<cnt<<"\n";
#include <bits/stdc++.h> #define ll long long #define ff first #define ss second #define pii pair<int,int> #define pb push_back #define eb emplace_back #define inf INT_MAX #define all(x) x.begin(),x.end() const int MOD = 1e9+7; using namespace std; void solve() { string s; cin>>s; int cnt=0; for (int i = 0; i < s.size(); i++) if (s[i] == 'A') for (int j = 1; 2 * j + i < s.size(); j++) cnt+=(s[i + j] == 'B' && s[i + j + j] == 'C'); cout<<cnt<<"\n"; } int main() { int T = 1; //cin >> T; while (T--) { solve(); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - A..B..C |
User | Altakkk |
Language | C++ 17 (gcc 12.2) |
Score | 200 |
Code Size | 649 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 3648 KiB |
Compile Error
Main.cpp: In function ‘void solve()’: Main.cpp:17:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 17 | for (int i = 0; i < s.size(); i++) | ~~^~~~~~~~~~ Main.cpp:19:39: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 19 | for (int j = 1; 2 * j + i < s.size(); j++) | ~~~~~~~~~~^~~~~~~~~~
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
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 | 3364 KiB |
00_sample_01.txt | AC | 1 ms | 3456 KiB |
00_sample_02.txt | AC | 1 ms | 3564 KiB |
01_random_00.txt | AC | 1 ms | 3452 KiB |
01_random_01.txt | AC | 1 ms | 3564 KiB |
01_random_02.txt | AC | 1 ms | 3460 KiB |
01_random_03.txt | AC | 1 ms | 3648 KiB |
01_random_04.txt | AC | 1 ms | 3524 KiB |
01_random_05.txt | AC | 2 ms | 3568 KiB |
01_random_06.txt | AC | 1 ms | 3436 KiB |
01_random_07.txt | AC | 1 ms | 3456 KiB |
01_random_08.txt | AC | 1 ms | 3512 KiB |
01_random_09.txt | AC | 1 ms | 3464 KiB |
01_random_10.txt | AC | 1 ms | 3524 KiB |
02_random2_00.txt | AC | 1 ms | 3484 KiB |
02_random2_01.txt | AC | 1 ms | 3496 KiB |
02_random2_02.txt | AC | 1 ms | 3492 KiB |
02_random2_03.txt | AC | 1 ms | 3564 KiB |
03_handmade_00.txt | AC | 1 ms | 3556 KiB |
03_handmade_01.txt | AC | 1 ms | 3364 KiB |
03_handmade_02.txt | AC | 1 ms | 3564 KiB |
03_handmade_03.txt | AC | 1 ms | 3492 KiB |
03_handmade_04.txt | AC | 1 ms | 3364 KiB |