Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

Integer Moves codeforces solution

#include<iostream>
#include<cmath>
using namespace std;

void solve()
{
	int x, y;
	double ans;
	cin >> x >> y;
	ans = sqrt(pow(0 - x, 2) + pow(0 - y, 2));
	if (x == 0 && y == 0)
		cout << 0 << "
";
	else if (ans == (int)ans)
		cout << 1 << "
";
	else
		cout << 2 << "
";
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Integer #Moves #codeforces #solution
ADD COMMENT
Topic
Name
9+8 =