Cod sursa(job #2339671)
Utilizator | Data | 9 februarie 2019 11:03:51 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include<iostream>
using namespace std;
#define mod 1999999973
int main()
{
long long x, rez = 1;
int n, m;
cin >> x >> n;
for( m = 1; m <= n; m *= 2 )
{
if( ( n & m ) != 0 )
rez = 1ll* rez * x % mod;
x = 1ll* x * x;
}
cout << rez;
return 0;
}