Cod sursa(job #3340349)
| Utilizator | Data | 13 februarie 2026 19:42:05 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int main() {
int n,p;
f>>n>>p;
long long rez=1;
while(p>0)
{
if(p%2==1)
{
rez=(rez*n)%1999999973;
}
n=(n*n)%1999999973;
p/=2;
}
g<<rez;
return 0;
}
