fzu1759

maksyuki 发表于 oj 分类,标签:
0

Problem Description

Given A,B,C, You should quickly calculate the result of A^B mod C. (1<=A,C<=1000000000,1<=B<=10^1000000).

 Input

There are multiply testcases. Each testcase, there is one line contains three integers A, B and C, separated by a single space.

 Output

For each testcase, output an integer, denotes the result of A^B mod C.

 Sample Input

3 2 4

2 10 1000

 Sample Output

1

24

 Source

FZU 2009 Summer Training IV--Number Theory

 

题目类型:欧拉定理降幂

算法分析:直接使用欧拉定理进行降幂处理,注意指数可能会比较大,需要从高位到低位按位取模计算