Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: hello world cc++ 
Cpp :: how to convert hexadecimal to decimal in c++ 
Cpp :: c++ remove all elements equal to 
Cpp :: c++ open webpage 
Cpp :: C++ Program to Find the Range of Data Types using Macro Constants 
Cpp :: for statement c++ 
Cpp :: printing in column c++ 
Cpp :: how to make loop in c++ 
Cpp :: c++ json parser euc-kr 
Cpp :: find vector size in c++ 
Cpp :: c++ define constant in class header 
Cpp :: opengl draw house using glut c++ 
Cpp :: opencv(4.5.1) c:usersappveyorappdatalocal emp1pip-req-build-kh7iq4w7opencvmodulesimgprocsrc esize.cpp:4051: error: (-215:assertion failed) !ssize.empty() in function 
Cpp :: inline function in cpp 
Cpp :: c++ for loop syntax 
Cpp :: clear map in C++ 
Cpp :: remove element from c++ 
Cpp :: cpp vector structure 
Cpp :: how to insert in a queue c++ 
Cpp :: how to rotate a matrix 90 degrees clockwise 
Cpp :: Maximum element in a map c++ 
Cpp :: binary tree 
Cpp :: cpp compare strings 
Cpp :: bit masking tricks 
Cpp :: c++ tuple push_back 
Cpp :: surf interpolation matlab 
Cpp :: warning: base will be initialized after 
Cpp :: sfml disable message 
Cpp :: jquery datepicker default date not working 
Cpp :: A Subtask Problem codechef solution in cpp 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =