Topic:
Power of stunts time limit (normal/java) : ms/3000 MS Run memory limit: 65536 KByte
Total submissions: 485 tested by: 106
Title Description
Power operation is one of the common mathematical operations, its principle is multiplied by the same number of times, but sometimes when the power exponent is particularly large, such an operation is too waste of time. Please learn to add special effects to power, so as to increase the efficiency of power operation to an acceptable degree.
Input
first row an integer T t
x Span style= "Box-sizing:border-box; Font-family: the song body; >, Y  ask x y 2 ≤ x, Y ≤10^9)
Output
Each set of data outputs an integer that represents the result of a power operation on the 1000000007 modulo
Sample input
2
2 4
2 100000000
Sample output
16
494499948
Source of the topic
Kojimai
Topic Analysis:
I understand this problem as "naked fast power" (do not know whether the correct understanding of the idea of the author, the following code for reference only). Originally want to Rob FB, but has not dared to hand, since the time also because of the data of the long long WA once.
The code is as follows:
/* * a.cpp * * Created on:2015 March 29 * author:administrator * * #include <iostream> #include <cstdio>u Sing namespace Std;long long Quickpow (Long long m, long long N, long long K) {long long B = 1;while (n > 0) {if (n & ; 1) {b = (b * m)% K;} n = n >> 1;m = (M * m)% K;} return b;} int main () {int t;scanf ("%d", &t), long long AA = 1000000007ll;while (t--) {Long Long A, b;scanf ("%i64d%i64d", &a, &B);p rintf ("%i64d\n", Quickpow (A, B, AA));} return 0;}
The power of the Noj network game c stunt