Cod sursa(job #2341979)

Utilizator Hexor_ALXAlexandru Olteanu Hexor_ALX Data 12 februarie 2019 14:41:55
Problema Ridicare la putere in timp logaritmic Scor 0
Compilator cpp-32 Status done
Runda Arhiva educationala Marime 0.86 kb
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll const mod=1000000007;
ll const md=998244353;
ll mypowr(ll a,ll b) {ll res=1;a%=mod; assert(b>=0);
for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll mypow(ll a,ll b) {ll res=1;assert(b>=0);
for(;b;b>>=1){if(b&1)res=res*a;a=a*a;}return res;}
ifstream in("lgput.in");
ofstream out("lgput.out");
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second



int main()
{   cout<<fixed<<setprecision(12);
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(0);

    ll a,b;
    in>>a>>b;
    ll p=1,y=1;
    while(b){
        if(b&1){
            y*=p;
            y%=1999999973;
        }
        p*=a;
        p%=1999999973;
        b/=2;
    }
    p*=y;
    p%=1999999973;
    out<<p<<'\n';




    return 0;
}