Cod sursa(job #2638708)
| Utilizator | Data | 29 iulie 2020 14:03:40 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.44 kb |
#include <iostream>
#include <fstream>
using namespace std;
const int MOD = 1999999973;
ifstream fin ( "lgput.in" );
ofstream fout ( "lgput.out" );
long long f_atob ( long long a, long long b ) {
long long res = 1;
while ( b ) {
if ( b & 1 )
res *= a % MOD, b --;
a *= a % MOD;
b /= 2;
}
return res;
}
int main()
{
long long n, k;
fin >> n >> k;
fout << f_atob ( n, k );
return 0;
}
