Pagini recente » Diferente pentru preoni-2007/clasament/10 intre reviziile 3 si 4 | Diferente pentru utilizator/razvy_b2000 intre reviziile 3 si 1 | Autentificare | Monitorul de evaluare | Cod sursa (job #2481937)
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int MOD = 1999999973;
long long putere_lg(long long base, long long exp)
{
long long p=1;
while(exp > 0)
{
if(exp & 1) ///este echivalent cu exp % 2 == 1
p = (p* (base%MOD))%MOD;
base = ((base%MOD) * (base%MOD) )% MOD;
exp = exp>>1; ///este echivalent cu p = p/2
}
return p;
}
int main()
{
long long a, b;
fin>>a>>b;
fout<<putere_lg(a, b)<<"\n";
return 0;
}