Pagini recente » Istoria paginii runda/885900 | Cod sursa (job #365921) | Cod sursa (job #2530171) | Cod sursa (job #2089588) | Cod sursa (job #2323616)
///Exponentiere in timp logaritmic
#include <fstream>
#define MOD 1999999973
using namespace std;
ifstream fin ("lgput.in");
ofstream fout("lgput.out");
long long a, b;
long long Ridicare(long long a, long long b)
{
if (b == 0)
return 1;
if (b == 1)
return a % 1999999973;
long long aux = Ridicare(a, b / 2);
aux = (aux * aux) % MOD;
if ( b % 2 == 1)
aux = (a * aux) % MOD;
return aux;
}
int main()
{
fin >> a >> b;
fout << Ridicare(a, b);
}