码迷,mamicode.com
首页 > 其他好文 > 详细

Super A^B mod C

时间:2014-07-29 11:08:56      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   strong   io   for   

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
 
处理大数的方法挺经典的,把别人代码贴出来以示膜拜
bubuko.com,布布扣view code

Super A^B mod C,布布扣,bubuko.com

Super A^B mod C

标签:style   blog   http   color   os   strong   io   for   

原文地址:http://www.cnblogs.com/zyx1314/p/3873888.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!