Cod sursa(job #3335843)
| Utilizator | Data | 23 ianuarie 2026 18:00:10 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.39 kb |
#include<fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long n, p, prod, c;
int main()
{
prod=1;
fin>>n>>p;
while(p!=0){
c=p%2;
if(c==1)
{
prod=prod*n;
prod=prod%1999999973;
}
p=p/2;
n=n*n;
n=n%1999999973;
}
fout<<prod;
return 0;
}
