21 条题解
-
-6
/***************************************** 备注:数学nanhai 5 ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; LL power(LL n , LL m , LL p) { if(n == 0) return 0; LL ans = 1; while(m) { if(m&1) ans = (ans * n) %p; m >>= 1; n = (n*n)%p; } return ans%p; } int main() { LL n , m , p; cin >> n >> m >> p; cout << power(n , m , p); return 0; }
信息
- ID
- 2
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 8
- 标签
- 递交数
- 3736
- 已通过
- 602
- 上传者