Fast Power Algorithm

Fast Power Algorithm

You cannot submit for this problem because the homework's deadline is due.

Description

Given \(a,b,p\), find \(a^b \bmod p\)

Format

Name your program as power.c

Input

Three integers \(a\), \(b\), and \(p\).

Output

A string in the format a^b mod p=s, where \(s=a^b \bmod p\).

Sample 1

Input

2 10 9

Output

2^10 mod 9=7

Limitation

\(0\le b,p < 2^{31}\), and \(1\le p<2^{31}\)

1s, 1024KiB for each test case.

Lab9

Not Claimed
Status
Finished
Problems
2
Open Since
2020-07-10 13:00
DDL
2020-07-16 23:59
Extension
24.0 hour(s)