29472023-02-05 17:04:32lazingergoGyros (30)cpp17Wrong answer 0/303ms3632 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/03ms1804 KiB
2Wrong answer0/02ms1996 KiB
3Wrong answer0/22ms2212 KiB
4Wrong answer0/23ms2420 KiB
5Wrong answer0/23ms2632 KiB
6Wrong answer0/33ms2848 KiB
7Wrong answer0/32ms2824 KiB
8Wrong answer0/33ms3056 KiB
9Wrong answer0/23ms3036 KiB
10Wrong answer0/23ms3396 KiB
11Wrong answer0/22ms3492 KiB
12Wrong answer0/32ms3632 KiB
13Wrong answer0/33ms3548 KiB
14Wrong answer0/32ms3476 KiB