Monday, June 25, 2018

LASTDIG - The last digit : Classical

#The solution in Python 3 is as follows:

for _ in range(int(input())):
a, b = map(int, input().split())
print (pow(a, b, 10))                                   #((a^b)%10)


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!