Cod sursa(job #2659067)
Utilizator | Data | 15 octombrie 2020 19:07:36 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.38 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long a,b,x,y,i,p;
int main()
{
fin>>a>>b;
p=1;
x=a%1999999973;
y=b;
do
{
if(x%2==1)
{
p=(p*y)%1999999973;
}
y=(y*y)%1999999973;
x=x/2;
}
while(x>0);
fout<<p;
return 0;
}