Pagini recente » Cod sursa (job #1379756) | Cod sursa (job #949600) | Cod sursa (job #875956) | Cod sursa (job #119479) | Cod sursa (job #635398)
Cod sursa(job #635398)
#include <iostream>
#include <deque>
#include <cstdio>
using namespace std;
const long long mod = 1999999973;
int main()
{
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
// deque<int> a;
//666013
long long x, p, rez = 1;
// int a[250];
cin >> x >> p;
while(p)
{
if(p%2)
rez = (rez*x)%mod;
x = (x*x)%mod;
p = p/2;
// a.push_back(p%2);
// a[i++] = p%2;
}
// for(deque<int>::iterator it = a.begin(); it < a.end(); it++)
// cout << *it;
// for(int j = i-1; j >= 0; j--)
// cout << a[j];
// cout << '\n\n';
// for(deque<int>::iterator it = a.begin(); it < a.end(); it++)
// {if(*it)
// rez = (rez * x)%mod;
// x = (x * x) % mod;
// }
cout << rez;
return 0;
}