Cod sursa(job #2362291)
Utilizator | Data | 3 martie 2019 09:17:13 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
#define Mod 1999999973
#define ll long long
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
ll n,p;
ll Power(ll p)
{
if(p==1)return n;
if(p%2==1)return (Power(p-1)*n)%Mod;
else
{
ll x=Power(p/2);
return (x*x)%Mod;
}
}
int main()
{
f>>n>>p;
///n^p
g<<Power(p);
return 0;
}