Skip to content

Instantly share code, notes, and snippets.

@sysuin
Created December 27, 2018 17:00
Show Gist options
  • Save sysuin/b17996f064306563731929a5139a2283 to your computer and use it in GitHub Desktop.
Save sysuin/b17996f064306563731929a5139a2283 to your computer and use it in GitHub Desktop.
Given two numbers A and B, find Kth digit from right of AB.
def kthdigit(a,b,k):
res = str(pow(a,b))
length = len(res)-k
print(res[length])
return
test = int(input())
for i in range(test):
abk = input().split()
a = int(abk[0])
b = int(abk[1])
k = int(abk[2])
kthdigit(a,b,k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment