29482023-02-05 17:04:58lazingergoGyros (30)cpp17Hibás válasz 15/303ms4052 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;
}

RészfeladatÖsszpontTesztVerdiktIdőMemória
base15/30
1Elfogadva0/03ms1936 KiB
2Hibás válasz0/03ms2156 KiB
3Elfogadva2/23ms2252 KiB
4Elfogadva2/23ms2480 KiB
5Elfogadva2/22ms2680 KiB
6Hibás válasz0/33ms3204 KiB
7Hibás válasz0/33ms3384 KiB
8Hibás válasz0/33ms3340 KiB
9Elfogadva2/23ms3456 KiB
10Elfogadva2/23ms3700 KiB
11Elfogadva2/23ms3784 KiB
12Elfogadva3/33ms3796 KiB
13Hibás válasz0/33ms4052 KiB
14Hibás válasz0/33ms3960 KiB