Cod sursa(job #3248959)
Utilizator | Data | 14 octombrie 2024 09:08:19 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
const int mod = 1999999973;
int main()
{
long long a, b;
fin >> a >> b;
int rez = 1;
while(b > 0)
{
if(b % 2 == 1)
rez = rez*a % mod;
a = a*a % mod;
b /= 2;
}
fout << rez;
return 0;
}