BETA

Difficulty Level: Basic

Submissions: 741 Accuracy:

30.5%

Check squares
     

Given an integer N, check if it is possible to represent it as a function(a, b) such that : a2 + b2 = N where "a" and "b" are whole numbers.
 

Input:
The first line of input contains an integer T, denoting number of test cases. Then T lines follow, each of them consisting of exactly one integer N.


Output:
For each test case output 1 if it is possible to represent given number as a sum of two squares and 0 if it is not possible.


Constraints:
1<=T<=100
1<=N<=106


Example:
Input:

3
1
2
7
Output:
1
1
0


Explanation  :
1 = 02 + 12   : Hence Possible : Output =  1  
2 = 12 + 12   : Hence Possible : Output =  1

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.