Cod sursa(job #3304298)
| Utilizator | Data | 22 iulie 2025 13:23:15 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.39 kb |
//#include <iostream>
#include <fstream>
using namespace std;
#define mod 1999999973
ifstream cin ("lgput.in"); ofstream cout ("lgput.out");
int main()
{
unsigned long long a, b, prod = 1;
cin >> a >> b;
while(b > 0)
{
if (b % 2 == 1)
{
prod = prod * a % mod;
}
a = (a * a) % mod;
b = b / 2;
}
cout << prod;
return 0;
}