Cod sursa(job #2569565)
| Utilizator | Data | 4 martie 2020 12:36:39 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | r3capitusulare | Marime | 0.28 kb |
#include <fstream>
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
const int mod=1999999973;
int main()
{
long long a,b,p=1;
fin >> a >> b;
while (b)
{
if (b%2==1) p=(p*a)%mod;
a=(a*a)%mod;
b/=2;
}
fout << p;
}
