You are viewing a single comment's thread. Return to all comments →
MOD = 10**9 + 7 def mod_expo(base, exponent, modulus): result = 1 base = base % modulus while exponent > 0: if exponent % 2 == 1: result = (result * base) % modulus exponent = exponent >> 1 base = (base * base) % modulus return result T = int(input().strip()) for _ in range(T): A, B = map(int, input().split()) print(mod_expo(A, B, MOD))
https://retrobowlcollege.com/
Seems like cookies are disabled on this browser, please enable them to open this website
Power of large numbers
You are viewing a single comment's thread. Return to all comments →
https://retrobowlcollege.com/