Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Programming Languages codechef solution in c++

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

void solve()
{
	ll a, b, a1, b1, a2, b2;
	cin >> a >> b >> a1 >> b1 >> a2 >> b2;
	ll cnt1 = 0, cnt2 = 0;
	if (a == a1 || a == b1)
		cnt1++;
	if (b == a2 || b == b2)
		cnt2++;
	if (cnt1 > 0 && cnt2 == 0)
		cout << 1 << "
";
	else if (cnt2 > 0 && cnt1 == 0)
		cout << 2 << "
";
	else
		cout << 0 << "
";
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
Source by codejudge.blogspot.com #
 
PREVIOUS NEXT
Tagged: #Programming #Languages #codechef #solution
ADD COMMENT
Topic
Name
8+8 =