Cod sursa(job #3210392)
Utilizator | Data | 6 martie 2024 10:02:20 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <fstream>
using namespace std;
ifstream fcin("lgput.in");
ofstream fout("lgput.out");
long long x,y,p,c,n;
int main()
{
fcin>>x>>y;
p=1;
while(y!=0)
{
c=y%2;
if(c==1)
{
p=(p*x)%1999999973;
}
y=y/2;
x=(x*x)%1999999973;
}
fout<<p%1999999973;
return 0;
}