Cod sursa(job #3283280)

Utilizator ioanxhIoan Xh ioanxh Data 8 martie 2025 20:06:09
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops,inline")
#define fast ios_base::sync_with_stdio(0);f.tie(0);g.tie(0);
using namespace std;
const string file="lgput";
ifstream f(file+".in");
ofstream g(file+".out");
//#define f cin
//#define g cout
#define ll long long
#define mod 1999999973
ll n,p;
ll lgpow(ll b, ll exp){
    ll r=1;
    while(exp){
        if(exp&1) r=1LL*r*b%mod;
        b=1LL*b*b%mod;
        exp>>=1;
    }
    return r;
}
int main(){
    f>>n>>p;
    g<<lgpow(n,p)%mod;
    return 0;
}