Created
December 27, 2018 17:00
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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