Cod sursa(job #3344078)
| Utilizator | Data | 1 martie 2026 12:39:46 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| 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");
const int MOD = 1999999973;
int lgput(int b, int e, int mod){
int p = 1;
while (e>0){
if (e%2){
p=(1LL*p*b)%mod;
}
b=(1LL*b*b)%mod;
e/=2;
}
return p;
}
int main(){
int b,e;
fin>>b>>e;
fout<<lgput(b, e, MOD);
}
