CSES - Datatähti 2022 loppu - Results
Submission details
Task:Järjestys
Sender:MojoLake
Submission time:2022-01-22 13:04:31 +0200
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:27:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = ama; i < s.length(); ++i){
                          ~~^~~~~~~~~~~~
input/code.cpp:26:13: warning: unused variable 'counta' [-Wunused-variable]
         int counta = 0;
             ^~~~~~

Code

#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
using namespace std;
const int N = (int)1e5;
const ll inf = (ll)1e18;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int t; cin >> t;
while(t--){
string s; cin >> s;
int ama=0, amb=0;
for(char c : s){
if(c=='A')ama++;
else amb++;
}
ll ans = 0;
int counta = 0;
for(int i = ama; i < s.length(); ++i){
if(s[i]=='A')ans++;
}
cout << ans << "\n";
}
return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1000
BBAABBBBAAABABBBAABBAABAAAABBB...

correct output
10
10
20
3
20
...

user output
10
10
20
3
20
...
Truncated