现在的位置: 首页 > 综合 > 正文

FZU 1752 A^B mod C

2013年03月16日 ⁄ 综合 ⁄ 共 992字 ⁄ 字号 评论关闭
文章目录

A^B mod C


Time Limit:1s Memory limit:32M
Accepted Submit:68 Total 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这题。)

 

抱歉!评论已关闭.