Pagini recente » Cod sursa (job #119429) | Cod sursa (job #2572339) | Cod sursa (job #951162) | Cod sursa (job #991581) | Cod sursa (job #2632678)
#include <bits/stdc++.h>
using namespace std;
const int x=1999999973;
long long n,p,temp;
void fast ()
{
ios_base::sync_with_stdio(false);
cin.tie();
}
long long put (long long a, long long b)
{
if (b==0)
return 1;
if (b%2==0)
{
temp = put (a, b/2);
return temp*temp%x;
}
if (b%2==1)
{
temp = put (a, (b-1)/2);
return temp*temp%x*a%x;
}
}
int main()
{
fast();
freopen("lgput.in","r", stdin);
freopen("lgput.out","w", stdout);
cin >> n >> p;
cout << put(n,p)%x;
return 0;
}
/// (5 + 5 * 5 ) % 2 = (5%2 + 5%2 * 5%2)%2