Answers for "Chef and Races codechef solution in c++"

C++
0

Chef and Races codechef solution in c++

#include<iostream>
#include<algorithm>
#include<vector>
#define ll long long
using namespace std;

void solve()
{
	vector<ll> v(4);
	for (int i = 0; i < 4; i++)
	{
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	v.erase(unique(v.begin(), v.end()), v.end());
	ll n = v.size();
	if (n == 4)
		cout << n / 2 << "\n";
	else 
		cout << (n - 1) / 2 << "\n";
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
Posted by: Guest on March-28-2022

Code answers related to "Chef and Races codechef solution in c++"

Browse Popular Code Answers by Language