29462023-02-05 17:03:27lazingergoGyros (30)cpp17Wrong answer 0/303ms3476 KiB
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <cctype>
#include <cstdlib>
#include <iomanip>
#include <math.h>


using namespace std;

#define ull unsigned long long
#define ll long long

const int I_INF = INT_MAX;
const ll LL_INF = LLONG_MAX;
const ull ULL_INF = ULLONG_MAX;




void solve()
{
	int vendegek, csirkehus, borjuhus;

	cin >> vendegek >> csirkehus >> borjuhus;

	string rendelesek;

	cin >> rendelesek;

	int csg, bg, vg;
	csg = bg = vg = 0;
	for (int i = 0; i < rendelesek.size(); i++)
	{
		if (rendelesek[i] == 'C')
			csg++;
		else if (rendelesek[i] == 'B')
			bg++;
		else
			vg++;

	}

//	cout << csg << " " << bg << " " << vg << endl;

	int gyrosdb=0;


	while (csg > 0 && csirkehus >= 2)
	{
		gyrosdb++;
		csirkehus -= 2;
		csg--;
	}

	while (bg > 0 && borjuhus >= 2)
	{
		gyrosdb++;
		borjuhus -= 2;
		bg--;
	}

	while (borjuhus >= 1 && csirkehus >= 1 && vg > 0)
	{
		gyrosdb++;
		vg--;
		borjuhus--;
		csirkehus--;
	}

	cout << gyrosdb<<endl;
}



int main()
{
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int t;
	cin >> t;

	while (t--)
	{
		solve();
	}
	return 0;
}

SubtaskSumTestVerdictTimeMemory
base0/30
1Wrong answer0/03ms2008 KiB
2Wrong answer0/03ms2164 KiB
3Wrong answer0/23ms2380 KiB
4Wrong answer0/22ms2592 KiB
5Wrong answer0/23ms2816 KiB
6Wrong answer0/32ms3076 KiB
7Wrong answer0/32ms3128 KiB
8Wrong answer0/33ms3304 KiB
9Wrong answer0/22ms3424 KiB
10Wrong answer0/23ms3444 KiB
11Wrong answer0/22ms3244 KiB
12Wrong answer0/32ms3248 KiB
13Wrong answer0/33ms3476 KiB
14Wrong answer0/32ms3380 KiB