URI Online Judge Solution 2867 Digits Using Python Programming Language.
Given two integers, n and m, how many digits have nm ?
Examples:
2 and 10 - 210 = 1024 - 4 digits
3 and
9 - 39 = 19683 - 5 digits
Input
The input is composed of several test cases. The first line has an integer C, representing the number of test cases. The following C lines contain two integers N and M (1 <= N, M <= 100).
Output
For each input test case of your program, you must print an integer containing the number of digits of the result of the calculated power in the respective test case.
URI 2867 Solution in Python:
T = int(input())
while T>0:
A,B = map(int,input().split())
A = A**B
A = len(str(A))
print(A)
T-=1
Comments
Post a Comment