Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- //#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
- #define pb push_back
- #define mp make_pair
- #define fi first
- #define se second
- #define gcd __gcd
- #define getl(s) getline(cin, s);
- #define setpre(x) fixed << setprecision(x)
- #define mset(a) memset(a, 0, sizeof(a))
- #define endl '\n'
- const int N=100050,M=1000000009;
- const ll INF=1e18+7;
- ll modular(ll x,ll y,ll m){
- ll res=1;
- x%=m;
- if(x==0) return 0;
- while(y>0){
- if(y&1) res=(res*x)%m;
- y/=2;
- x=(x*x)%m;
- }
- return res;
- }
- ll indian_mul(ll a,ll b){
- if(b==0) return 0;
- ll n=indian_mul(a,b/2);
- if(b%2==0) return (n+n)%M;
- return (n+n+a)%M;
- }
- int main(){
- ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
- // freopen(".inp","r",stdin);
- // freopen(".out","w",stdout);
- ll a,b,m;
- cin>>a>>b>>m;
- cout<<modular(a,b,m);
- return 0;
- }
- /*
- ==================================+
- INPUT: |
- ------------------------------ |
- ------------------------------ |
- ==================================+
- OUTPUT: |
- ------------------------------ |
- ------------------------------ |
- ==================================+
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement