3112021-09-22 13:04:11Kevinke12Gyros (30)cpp14Wrong answer 2/302ms2000 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-=2;
        }
        if((s[i]=='C') && (cs>0))
        {
            ans++;
            cs-=2;
        }
        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
base2/30
1Accepted0/02ms1784 KiB
2Wrong answer0/02ms1900 KiB
3Wrong answer0/21ms1860 KiB
4Wrong answer0/21ms1888 KiB
5Wrong answer0/21ms1892 KiB
6Wrong answer0/31ms1884 KiB
7Wrong answer0/32ms1920 KiB
8Wrong answer0/31ms1900 KiB
9Wrong answer0/21ms1908 KiB
10Wrong answer0/21ms1904 KiB
11Accepted2/21ms1908 KiB
12Wrong answer0/31ms1928 KiB
13Wrong answer0/32ms1984 KiB
14Wrong answer0/32ms2000 KiB