Time limit of the second-order modulus: +Ms | Memory Limit:65535KB Difficulty:3
-
-
Describe
-
The value of the B-square to the C-remainder of a
-
-
Input
-
-
The first line enters an integer n indicates the number of groups of test data (n<100)
Only one row per group of tests, with three positive integers a,b,c (1=<a,b,c<=1000000000)
-
-
Output
-
The result of the
-
B-side of output A to the C-remainder
-
-
Sample input
-
-
32 3 53 100 1011 12345 12345
-
-
Sample output
-
-
3110481
-
-
Source
-
-
[Zhang Yunzun] Original
-
-
Uploaded by
Zhang Yunzun
Reference: http://acm.nyist.net/JudgeOnline/talking.php?pid=102 56 Floor
I don't know why I do this, remember ~
#include <iostream> #include <stdio.h>using namespace std;int dy (int m,int n,int p) {if (n==0) return 1%p;int Temp=dy (m,n>>1,p); temp= (Long Long) temp*temp%p;if (n&1) temp= (long long) Temp*m%p;return temp;} int main () {int t,m,n,p;cin>>t; while (t--) { cin>>m>>n>>p; Cout<<dy (M,n,p) <<endl;} return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The second-party evaluation model