Responsive image

问题 1274 -- a^(b^c)

1274: a^(b^c)

时间限制: 1 Sec  内存限制: 128 MB
提交: 38  解决: 2
[提交][状态][讨论版][命题人:]

题目描述

 H1N1 like to solve acm problems.But they are very busy, one day they meet a problem. Given three intergers a,b,c, the task is to compute a^(b^c))%317000011. 1412, ziyuan and qu317058542 don't have time to solve it, so the turn to you for help.

输入描述

The first line contains an integer T which stands for the number of test cases. Each case consists of three integer a, b, c seperated by a space in a single line. 1 <= a,b,c <= 100000

输出描述

For each case, print a^(b^c)%317000011 in a single line.

样例输入

2
1 1 1
2 2 2

样例输出

1
16

提示

 费马小定理

来源

[提交][状态]
ACM算法攻关部
  • Anything about this OnlineJudge, Please Contact Administrator. Click add QQ

    OJ system based on HUSTOJ Project , UI based on Twitter Bootstrap

    Copyright 2016 ACM算法攻关部
    关于网站改版