Cod sursa(job #2843199)
Utilizator | Samy Dragos samyro14 | Data | 2 februarie 2022 10:39:58 |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.4 kb |
#include <fstream>
using namespace std;
ifstream cin("f.in");
ofstream cout("f.out");
const long long mod = 1999999973;
unsigned long long int a, b, p = 1;
int main(){
cin >> a >> b;
while(b){
if( b % 2 == 1) p = (1ull * p % mod * a % mod) % mod;
a = (1ull * a % mod * a % mod) % mod;
b /= 2;
}
cout << p % mod;
return 0;
}