1245A. Good ol' Numbers Coloring - Codeforces Solution C++

  Problem Link : 1245A. Good ol' Numbers Coloring 


✅ C++ Solution :

 
#include<bits/stdc++.h>
using namespace std;

int main()
{
	int t;
	cin>>t;
	bool arr[1000001];
	while(t--)
	{
		int a,b;
		cin>>a>>b;
		if(a>b)
		{
			int temp=a;
			a=b;
			b=temp;
		}
		if(__gcd(a,b)==1)
			cout<<"Finite\n";
		else
			cout<<"Infinite\n";
	}
}

 

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook. 

😇Happy Learning!!