Cod sursa(job #2669526)

Utilizator Sho10Andrei Alexandru Sho10 Data 7 noiembrie 2020 10:38:02
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.8 kb
#include <bits/stdc++.h> //JuniorMonster a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1999999973
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll x,y;
ll pw(ll,ll);
int32_t main(){
CODE_START;
ifstream cin("lgput.in");
ofstream cout("lgput.out");
cin>>x>>y;
cout<<pw(x,y);
}
ll pw(ll a,ll b){
    if(b==0) return 1;
    ll n=pw(a,b/2);
    if(b%2==1){
            return (((n*n)%mod)*a)%mod;
    }else return (n*n)%mod;
}