Preparing NOJ

模运算

1000ms 65536K

Description:

给定整数a,b,n,要求计算(a^b)mod n

Input:

多组数据,每组数据一行,为三个用空格隔开的整数a,b,n

1<=a<=5000,0<=b<=10^8,1<=n<=5000000

Output:

每组数据输出一行,为所求值

Sample Input:

2 3 5
2 2 4

Sample Output:

3
0

Note:

本题由旧版NOJ导入,来源:NUAA

Info

NOJ

Provider NOJ

Code NOJ1037

Tags

Submitted 95

Passed 30

AC Rate 31.58%

Date 04/20/2019 10:03:10

Related

Nothing Yet