1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int x, p, m, i, result; int main() { cin>>x>>p>> m; result = 1 ; while(p > 0) { if (p % 2 == 1) result = result * x % m; p /= 2; x = x * x % m; } cout<<result<< endl; return 0; }
Python :
x,p,m = map(int,input().split()) t=x**p r=t%m print(r)
- 1
Information
- ID
- 10408
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By