Trimorphic Number
Submissions: 2612   Accuracy:

22.55%

  Difficulty: Basic   Marks: 1

Given a number N, the task is to check whether the number is Trimorphic number or not. A number is called Trimorphic number if and only if its cube ends in the same digits as the number itself. In other words, number appears at the end of its cube.

Input:
The first line contains an integer T, denoting the number of testcases. T testcases follow. Each testcase contains a single integer N as input.

Output:
Print 1 if the number is trimorphic; else print 0.

Constraints:
1<=T<=100
0<=N<=10000

Example:

Input:
3
1
2
24

Output:
1
0
1

Explanation:
For testcase 3: 24 is N.The cube of 24 is 13824. Since 13824 contains 24, so 24 is a trimorphic number. We print 1.

 

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

Contributor: Ankit Sharma
Author: Soul_xhacker


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



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


to report an issue on this page.