3092021-09-21 19:57:45Kevinke12Gyros (30)cpp14Wrong answer 0/302ms1988 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int Ans(int cs, int b, string s)
{
    int ans=0;
    for(int i = 0; i < s.length(); i++)
    {
        if((s[i]=='B') && (b>0))
        {
            ans++;
            b--;
        }
        if((s[i]=='C') && (cs>0))
        {
            ans++;
            cs--;
        }
        if((s[i]=='B') && (b>0) &&(cs>0))
        {
            ans++;
            b--;cs--;
        }
    }
    return ans;
}

int main()
{
    int T, be1, be2;
    string be3;
    cin >> T;
    for(int i = 0; i < T; i++)
    {
        cin >> be1 >> be1 >> be2 >>be3;
        cout << Ans(be1, be2, be3) << "\n";
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/30
1Accepted0/02ms1792 KiB
2Wrong answer0/02ms1832 KiB
3Wrong answer0/22ms1868 KiB
4Wrong answer0/21ms1888 KiB
5Wrong answer0/21ms1884 KiB
6Wrong answer0/31ms1892 KiB
7Wrong answer0/32ms1924 KiB
8Wrong answer0/31ms1908 KiB
9Wrong answer0/21ms1908 KiB
10Wrong answer0/21ms1916 KiB
11Wrong answer0/21ms1920 KiB
12Wrong answer0/31ms1936 KiB
13Wrong answer0/32ms1976 KiB
14Wrong answer0/32ms1988 KiB