FZU 1752 A^B mod C

A^B mod C


Time Limit:1sMemory limit:32M
Accepted Submit:68Total Submit:376

Problem Description

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

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

Original: FZU 2009 Summer Training IV--Number Theory

解题:

        强大的题目。需要考虑数据过大问题,数据处理过程中又可能有溢出。针对模取幂运算,收集转载一些很不错的文章。写在下一篇。(以下代码能过FZU 1650 ,但1650的代码不一定能通过1752这题。)

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值