You are given two integers N and P. N represents an integer number, and P represents the power to which N will be raised. You need the determine, if the units digit of the NP will be same as the units digit of N.
The first line of the input contains a single integer T, denoting the number of test cases. Then T test case follows. Each test case contains 2 lines,The number N and the power P.
For each testcase, print 0 if the units digit changes, else print 1.
1 <= T <= 100
1 <= N <= 1030
1 <= P <= 100
For testcase 1: 21=2 so units digit remains same. Therefore, we print 1
For testcase 3: 42=16 so units digit changes from 4 to 6. Therefore, we print 0
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.