1 solutions
-
0
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long b, long long k) { long long res = 1; a %= k; while(b) { if(b & 1) res = res * a % k; a = a * a % k; b >>= 1; } return res; } int main() { long long a, b, k; cin >> a >> b >> k; long long res = power(a, b, k); printf("%lld^%lld mod %lld=%lld", a, b, k, res); return 0; }
- 1
Information
- ID
- 406
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 10
- Tags
- # Submissions
- 2
- Accepted
- 1
- Uploaded By