Power Mod
Python
Medium
2 views
Problem Description
Integers a b m are provided. Output (a^b) % m. Use fast power (pow with mod).
Input Format
One line: a b m.
Output Format
One integer ans.
Official Solution
import sys
p=sys.stdin.read().strip().split()
if len(p)<3: sys.exit(0)
a=int(p[0]); b=int(p[1]); m=int(p[2])
sys.stdout.write(str(pow(a,b,m)))
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!